env-util: fix parameter handling of parse_env_extension_hierarchies() + getenv_path_list()
Our coding style dictates we should not clobber return parameters on failure, and always initialize them on success. Do so here. This changes getenv_path_list() to return ENXIO if the env var is not set, which is similar to how we handle this in getenv_bool(). This drops debug logging from parse_env_extension_hierarchies(), since it's done anyway in getenv_path_list() Follow-up for: #18018
This commit is contained in:
@@ -813,11 +813,9 @@ int getenv_path_list(const char *name, char ***ret_paths) {
|
||||
assert(name);
|
||||
assert(ret_paths);
|
||||
|
||||
*ret_paths = NULL;
|
||||
|
||||
e = secure_getenv(name);
|
||||
if (!e)
|
||||
return 0;
|
||||
return -ENXIO;
|
||||
|
||||
r = strv_split_full(&l, e, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
|
||||
if (r < 0)
|
||||
@@ -842,5 +840,5 @@ int getenv_path_list(const char *name, char ***ret_paths) {
|
||||
"No paths specified, refusing.");
|
||||
|
||||
*ret_paths = TAKE_PTR(l);
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user