diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2015-11-05 13:44:10 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2015-11-05 13:44:10 +0100 |
commit | 4314d33f514212f1f353c80cda4d4f0b845e082e (patch) | |
tree | 21e877d7f7e82e10f86ca1e5d8b9a3e4c8464db9 /src | |
parent | e26ea7fc2d7e210f60f12ad40f76b6e4dca48c27 (diff) |
nspawn: simplify error returns
Use the "return log_error_errno(...)" idiom to have fewer curly braces.
The last hunk also fixes the return value of setup_journal(), but the
fix has no practical effect.
Diffstat (limited to 'src')
-rw-r--r-- | src/nspawn/nspawn.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index a57902c8c2..375906fd1d 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1412,15 +1412,11 @@ static int setup_journal(const char *directory) { if (errno == ENOTDIR) { log_error("%s already exists and is neither a symlink nor a directory", p); return r; - } else { - log_error_errno(errno, "Failed to remove %s: %m", p); - return -errno; - } + } else + return log_error_errno(errno, "Failed to remove %s: %m", p); } - } else if (r != -ENOENT) { - log_error_errno(r, "readlink(%s) failed: %m", p); - return r; - } + } else if (r != -ENOENT) + return log_error_errno(r, "readlink(%s) failed: %m", p); if (arg_link_journal == LINK_GUEST) { @@ -1428,10 +1424,8 @@ static int setup_journal(const char *directory) { if (arg_link_journal_try) { log_debug_errno(errno, "Failed to symlink %s to %s, skipping journal setup: %m", q, p); return 0; - } else { - log_error_errno(errno, "Failed to symlink %s to %s: %m", q, p); - return -errno; - } + } else + return log_error_errno(errno, "Failed to symlink %s to %s: %m", q, p); } r = userns_mkdir(directory, p, 0755, 0, 0); @@ -1448,10 +1442,8 @@ static int setup_journal(const char *directory) { if (arg_link_journal_try) { log_debug_errno(errno, "Failed to create %s, skipping journal setup: %m", p); return 0; - } else { - log_error_errno(errno, "Failed to create %s: %m", p); - return r; - } + } else + return log_error_errno(errno, "Failed to create %s: %m", p); } } else if (access(p, F_OK) < 0) |