zero(*paths);
return lookup_paths_init(paths,
- scope == UNIT_FILE_SYSTEM ? MANAGER_SYSTEM : MANAGER_USER,
+ scope == UNIT_FILE_SYSTEM ? SYSTEMD_SYSTEM : SYSTEMD_USER,
scope == UNIT_FILE_USER,
NULL, NULL, NULL);
}
int r = 0;
DIR *d;
- struct dirent buffer, *de;
assert(remove_symlinks_to);
assert(fd >= 0);
rewinddir(d);
for (;;) {
+ struct dirent *de;
+ union dirent_storage buf;
int k;
- k = readdir_r(d, &buffer, &de);
+ k = readdir_r(d, &buf.de, &de);
if (k != 0) {
r = -errno;
break;
int r = 0;
DIR *d;
- struct dirent buffer, *de;
assert(name);
assert(fd >= 0);
for (;;) {
int k;
+ struct dirent *de;
+ union dirent_storage buf;
- k = readdir_r(d, &buffer, &de);
+ k = readdir_r(d, &buf.de, &de);
if (k != 0) {
r = -errno;
break;
UnitFileState *state) {
int r;
- char *path;
+ char _cleanup_free_ *path = NULL;
bool same_name_link_runtime = false, same_name_link = false;
assert(scope >= 0);
return r;
r = find_symlinks(name, path, &same_name_link_runtime);
- free(path);
-
if (r < 0)
return r;
else if (r > 0) {
return r;
r = find_symlinks(name, path, &same_name_link);
- free(path);
-
if (r < 0)
return r;
else if (r > 0) {
UnitFileChange **changes,
unsigned *n_changes) {
- char **i, *prefix;
+ char **i;
+ char _cleanup_free_ *prefix;
int r;
assert(scope >= 0);
return r;
STRV_FOREACH(i, files) {
- char *path;
+ char _cleanup_free_ *path = NULL;
if (!unit_name_is_valid(*i, true)) {
if (r == 0)
if (symlink("/dev/null", path) >= 0) {
add_file_change(changes, n_changes, UNIT_FILE_SYMLINK, path, "/dev/null");
- free(path);
continue;
}
if (errno == EEXIST) {
- if (null_or_empty_path(path) > 0) {
- free(path);
+ if (null_or_empty_path(path) > 0)
continue;
- }
if (force) {
unlink(path);
add_file_change(changes, n_changes, UNIT_FILE_UNLINK, path, NULL);
add_file_change(changes, n_changes, UNIT_FILE_SYMLINK, path, "/dev/null");
- free(path);
continue;
}
}
if (r == 0)
r = -errno;
}
-
- free(path);
}
- free(prefix);
-
return r;
}
/* This will return the number of symlink rules that were
supposed to be created, not the ones actually created. This is
- useful to determine whether the passed files hat any
+ useful to determine whether the passed files had any
installation data at all. */
r = install_context_apply(&c, &paths, config_path, root_dir, force, changes, n_changes);
return r;
STRV_FOREACH(i, paths.unit_path) {
- struct dirent buffer, *de;
const char *units_dir;
free(buf);
}
for (;;) {
+ struct dirent *de;
+ union dirent_storage buffer;
UnitFileList *f;
- r = readdir_r(d, &buffer, &de);
+ r = readdir_r(d, &buffer.de, &de);
if (r != 0) {
r = -r;
goto finish;