diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-01 09:04:27 -0500 |
---|---|---|
committer | Martin Pitt <martinpitt@users.noreply.github.com> | 2017-02-01 15:04:27 +0100 |
commit | 785d345145bbd06c8f1c75c6a0b119c4e8f411db (patch) | |
tree | 207446c896cd6006f0efde1e72919cb6bc208e92 /src/journal | |
parent | 1a68e1e543fd8f899503bec00585a16ada296ef7 (diff) |
Trivial typo fixes and code refactorings (#5191)
* logind: trivial simplification
free_and_strdup() handles NULL arg, so make use of that.
* boot: fix two typos
* pid1: rewrite check in ignore_proc() to not check condition twice
It's harmless, but it seems nicer to evaluate a condition just a single time.
* core/execute: reformat exec_context_named_iofds() for legibility
* core/execute.c: check asprintf return value in the usual fashion
This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.
CID #1368227.
* core/timer: use (void)
CID #1368234.
* journal-file: check asprintf return value in the usual fashion
This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.
CID #1368236.
* shared/cgroup-show: use (void)
CID #1368243.
* cryptsetup: do not return uninitialized value on error
CID #1368416.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journal-file.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index e45d1905e7..0a264aef92 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -3087,13 +3087,18 @@ int journal_file_open( } } - if (fname) + if (fname) { f->path = strdup(fname); - else /* If we don't know the path, fill in something explanatory and vaguely useful */ - asprintf(&f->path, "/proc/self/%i", fd); - if (!f->path) { - r = -ENOMEM; - goto fail; + if (!f->path) { + r = -ENOMEM; + goto fail; + } + } else { + /* If we don't know the path, fill in something explanatory and vaguely useful */ + if (asprintf(&f->path, "/proc/self/%i", fd) < 0) { + r = -ENOMEM; + goto fail; + } } f->chain_cache = ordered_hashmap_new(&uint64_hash_ops); |