diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-11-08 13:54:18 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-11-08 14:07:27 +0100 |
commit | 97137ecce66197dda9e276575f10ff262c76fda7 (patch) | |
tree | 113eb50109fab0fbe6f9c6dbccc3d93de3499861 /src/shared | |
parent | 8fe12d88a8b4d5beb64e5d4efd205043a01b0c13 (diff) |
install: don't override caller's parameter
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/install.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index 987b36d40b..cfd4a5af8a 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -1618,6 +1618,7 @@ int unit_file_get_default( STRV_FOREACH(p, paths.unit_path) { _cleanup_free_ char *path = NULL, *tmp = NULL; + char *n; if (isempty(root_dir)) path = strappend(*p, "/default.target"); @@ -1630,13 +1631,14 @@ int unit_file_get_default( r = readlink_malloc(path, &tmp); if (r == -ENOENT) continue; - else if (r < 0) + if (r < 0) return r; - *name = strdup(path_get_file_name(tmp)); - if (!*name) + n = strdup(path_get_file_name(tmp)); + if (!n) return -ENOMEM; + *name = n; return 0; } |