_cleanup_free_ char *p = NULL, *s = NULL;
UnitFileChange *c;
- assert(path);
assert(!changes == !n_changes);
if (type_or_errno >= 0)
return -ENOMEM;
*changes = c;
- p = strdup(path);
- if (!p)
- return -ENOMEM;
+ if (path) {
+ p = strdup(path);
+ if (!p)
+ return -ENOMEM;
- path_simplify(p);
+ path_simplify(p);
+ }
if (source) {
s = strdup(source);
log_warning("Unit %s is added as a dependency to a non-existent unit %s.",
changes[i].source, changes[i].path);
break;
+ case UNIT_FILE_AUXILIARY_FAILED:
+ if (!quiet)
+ log_warning("Failed to enable auxiliary unit %s, ignoring.", changes[i].source);
+ break;
case -EEXIST:
if (changes[i].source)
log_error_errno(changes[i].type_or_errno,
q = install_info_traverse(scope, c, paths, i, flags, NULL);
if (q < 0) {
+ if (i->auxiliary) {
+ q = unit_file_changes_add(changes, n_changes, UNIT_FILE_AUXILIARY_FAILED, NULL, i->name);
+ if (q < 0)
+ return q;
+ continue;
+ }
+
unit_file_changes_add(changes, n_changes, q, i->name, NULL);
return q;
}
[UNIT_FILE_IS_MASKED] = "masked",
[UNIT_FILE_IS_DANGLING] = "dangling",
[UNIT_FILE_DESTINATION_NOT_PRESENT] = "destination not present",
+ [UNIT_FILE_AUXILIARY_FAILED] = "auxiliary unit failed",
};
DEFINE_STRING_TABLE_LOOKUP(unit_file_change_type, int);
UNIT_FILE_IS_MASKED,
UNIT_FILE_IS_DANGLING,
UNIT_FILE_DESTINATION_NOT_PRESENT,
+ UNIT_FILE_AUXILIARY_FAILED,
_UNIT_FILE_CHANGE_TYPE_MAX,
_UNIT_FILE_CHANGE_TYPE_INVALID = -EINVAL,
};