1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-24 06:04:05 +03:00

dropin: always initialize return parameters on success

Just as a matter of coding style: whenever we return successfully, let's
make sure all our return parameters are properly initialized to
something.
This commit is contained in:
Lennart Poettering 2017-02-09 20:10:03 +01:00
parent a09d3eafac
commit 058db92528

View File

@ -185,27 +185,30 @@ int unit_file_find_dropin_paths(
const char *dir_suffix, const char *dir_suffix,
const char *file_suffix, const char *file_suffix,
Set *names, Set *names,
char ***paths) { char ***ret) {
_cleanup_strv_free_ char **dirs = NULL, **ans = NULL; _cleanup_strv_free_ char **dirs = NULL, **ans = NULL;
Iterator i; Iterator i;
char *t, **p; char *t, **p;
int r; int r;
assert(paths); assert(ret);
SET_FOREACH(t, names, i) SET_FOREACH(t, names, i)
STRV_FOREACH(p, lookup_path) STRV_FOREACH(p, lookup_path)
unit_file_find_dirs(original_root, unit_path_cache, *p, t, dir_suffix, &dirs); unit_file_find_dirs(original_root, unit_path_cache, *p, t, dir_suffix, &dirs);
if (strv_isempty(dirs)) if (strv_isempty(dirs)) {
*ret = NULL;
return 0; return 0;
}
r = conf_files_list_strv(&ans, file_suffix, NULL, (const char**) dirs); r = conf_files_list_strv(&ans, file_suffix, NULL, (const char**) dirs);
if (r < 0) if (r < 0)
return log_warning_errno(r, "Failed to sort the list of configuration files: %m"); return log_warning_errno(r, "Failed to sort the list of configuration files: %m");
*paths = ans; *ret = ans;
ans = NULL; ans = NULL;
return 1; return 1;
} }