diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-02 22:37:53 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-02 22:37:53 +0200 |
commit | 84267e4043cf88bf540b5bf9cd65e194670a4ffa (patch) | |
tree | 4e2f3e8359b812eed973a4eebd4c0f07ec441f55 | |
parent | 804ae586d475d77946debb22c1bc9ee049d4750c (diff) |
journal: prefer stack allocation
-rw-r--r-- | src/journal/journald-server.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c index 50e9b08da9..3538ddc13f 100644 --- a/src/journal/journald-server.c +++ b/src/journal/journald-server.c @@ -926,7 +926,7 @@ finish: static int system_journal_open(Server *s, bool flush_requested) { int r; - char *fn; + const char *fn; sd_id128_t machine; char ids[33]; @@ -969,9 +969,7 @@ static int system_journal_open(Server *s, bool flush_requested) { if (!s->runtime_journal && (s->storage != STORAGE_NONE)) { - fn = strjoin("/run/log/journal/", ids, "/system.journal", NULL); - if (!fn) - return -ENOMEM; + fn = strjoina("/run/log/journal/", ids, "/system.journal", NULL); if (s->system_journal) { @@ -980,8 +978,6 @@ static int system_journal_open(Server *s, bool flush_requested) { * it into the system journal */ r = journal_file_open(fn, O_RDWR, 0640, s->compress, false, &s->runtime_metrics, s->mmap, NULL, &s->runtime_journal); - free(fn); - if (r < 0) { if (r != -ENOENT) log_warning_errno(r, "Failed to open runtime journal: %m"); @@ -999,8 +995,6 @@ static int system_journal_open(Server *s, bool flush_requested) { (void) mkdir_parents(fn, 0750); r = journal_file_open_reliably(fn, O_RDWR|O_CREAT, 0640, s->compress, false, &s->runtime_metrics, s->mmap, NULL, &s->runtime_journal); - free(fn); - if (r < 0) return log_error_errno(r, "Failed to open runtime journal: %m"); } |