diff options
author | Martin Pitt <martin.pitt@ubuntu.com> | 2016-07-23 10:10:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-23 10:10:53 +0200 |
commit | 1415e04603b7c243d70a70231d7d3eb184224597 (patch) | |
tree | fc4f6bef0fb8782665a90f015eacdb13e949cab4 /src/nspawn | |
parent | 771de3f506ac5b9f5846acae70d8e558d969d018 (diff) | |
parent | 476b8254d95488d09eebdbd175494aaafac23a3e (diff) |
Merge pull request #3785 from keszybz/less-return-errno
Use "return log_error_errno(...)" in more places + related fixes
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn-seccomp.c | 6 | ||||
-rw-r--r-- | src/nspawn/nspawn-setuid.c | 7 | ||||
-rw-r--r-- | src/nspawn/nspawn.c | 2 |
3 files changed, 5 insertions, 10 deletions
diff --git a/src/nspawn/nspawn-seccomp.c b/src/nspawn/nspawn-seccomp.c index 54db1b47f8..3ab7160ebe 100644 --- a/src/nspawn/nspawn-seccomp.c +++ b/src/nspawn/nspawn-seccomp.c @@ -119,10 +119,8 @@ static int seccomp_add_default_syscall_filter(scmp_filter_ctx ctx, r = seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), blacklist[i].syscall_num, 0); if (r == -EFAULT) continue; /* unknown syscall */ - if (r < 0) { - log_error_errno(r, "Failed to block syscall: %m"); - return r; - } + if (r < 0) + return log_error_errno(r, "Failed to block syscall: %m"); } return 0; diff --git a/src/nspawn/nspawn-setuid.c b/src/nspawn/nspawn-setuid.c index ee15a47e93..b8e8e091c8 100644 --- a/src/nspawn/nspawn-setuid.c +++ b/src/nspawn/nspawn-setuid.c @@ -124,14 +124,12 @@ int change_uid_gid(const char *user, char **_home) { fd = -1; if (!fgets(line, sizeof(line), f)) { - if (!ferror(f)) { log_error("Failed to resolve user %s.", user); return -ESRCH; } - log_error_errno(errno, "Failed to read from getent: %m"); - return -errno; + return log_error_errno(errno, "Failed to read from getent: %m"); } truncate_nl(line); @@ -214,8 +212,7 @@ int change_uid_gid(const char *user, char **_home) { return -ESRCH; } - log_error_errno(errno, "Failed to read from getent: %m"); - return -errno; + return log_error_errno(errno, "Failed to read from getent: %m"); } truncate_nl(line); diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index da8bee3244..b1c012a9e4 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3553,7 +3553,7 @@ int main(int argc, char *argv[]) { } if (r < 0) { log_error_errno(r, "Failed to lock %s: %m", arg_directory); - return r; + goto finish; } if (arg_template) { |