diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-06-19 21:48:32 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-06-19 22:04:29 -0400 |
commit | f56506141cbf6391b0373108a2522ba771b25f4b (patch) | |
tree | 24f8bf4287f087c4da84fa57ecde9d77e2b28d17 | |
parent | 71418295125c542d3edd1e7251bb0701ef1af89b (diff) |
getty-generator: use strappenda
Allocating on the stack should be fine for the fixed number
of items.
-rw-r--r-- | src/getty-generator/getty-generator.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c index 6a4aa2c1d9..35cd8589fc 100644 --- a/src/getty-generator/getty-generator.c +++ b/src/getty-generator/getty-generator.c @@ -35,19 +35,14 @@ static const char *arg_dest = "/tmp"; static int add_symlink(const char *fservice, const char *tservice) { - _cleanup_free_ char *from = NULL, *to = NULL; + char *from, *to; int r; assert(fservice); assert(tservice); - from = strappend(SYSTEM_DATA_UNIT_PATH "/", fservice); - if (!from) - return log_oom(); - - to = strjoin(arg_dest,"/getty.target.wants/", tservice, NULL); - if (!to) - return log_oom(); + from = strappenda(SYSTEM_DATA_UNIT_PATH "/", fservice); + to = strappenda3(arg_dest, "/getty.target.wants/", tservice); mkdir_parents_label(to, 0755); @@ -221,14 +216,9 @@ int main(int argc, char *argv[]) { /* Automatically add in a serial getty on the first * virtualizer console */ NULSTR_FOREACH(j, virtualization_consoles) { - _cleanup_free_ char *p = NULL; - - p = strappend("/sys/class/tty/", j); - if (!p) { - log_oom(); - return EXIT_FAILURE; - } + char *p; + p = strappenda("/sys/class/tty/", j); if (access(p, F_OK) < 0) continue; |