summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-11-21 19:32:33 +0100
committerLennart Poettering <lennart@poettering.net>2013-11-21 21:12:36 +0100
commit0ccad099d4c08dc5a16c87cdd6eefc05e9d4b670 (patch)
tree4eefc958308dbed9590bc5070cbbc404e4378597 /src
parent9d5a3757c3e5bc2266053dbadb4a542a6dd5e7b8 (diff)
hostnamed: modernizations
Diffstat (limited to 'src')
-rw-r--r--src/hostname/hostnamed.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
index 332c00bee5..c874ea2f6c 100644
--- a/src/hostname/hostnamed.c
+++ b/src/hostname/hostnamed.c
@@ -266,7 +266,7 @@ static int context_write_data_other(Context *c) {
[PROP_CHASSIS] = "CHASSIS"
};
- char **l = NULL;
+ _cleanup_strv_free_ char **l = NULL;
int r, p;
assert(c);
@@ -285,17 +285,16 @@ static int context_write_data_other(Context *c) {
continue;
}
- if (asprintf(&t, "%s=%s", name[p], strempty(c->data[p])) < 0) {
- strv_free(l);
+ if (asprintf(&t, "%s=%s", name[p], strempty(c->data[p])) < 0)
return -ENOMEM;
- }
u = strv_env_set(l, t);
free(t);
- strv_free(l);
if (!u)
return -ENOMEM;
+
+ strv_free(l);
l = u;
}
@@ -307,10 +306,7 @@ static int context_write_data_other(Context *c) {
return 0;
}
- r = write_env_file_label("/etc/machine-info", l);
- strv_free(l);
-
- return r;
+ return write_env_file_label("/etc/machine-info", l);
}
static int property_get_icon_name(