X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Frun%2Frun.c;h=85eb052343a5d73b2d8d2958aa12aa83bb7fc13d;hb=30fbcf24460263961855e0ce4d8867fd2af3e149;hp=b96517a99ac5313de39b92350820a6de41607d2a;hpb=f647962d64e844689f3e2acfce6102fc47e76df2;p=elogind.git diff --git a/src/run/run.c b/src/run/run.c index b96517a99..85eb05234 100644 --- a/src/run/run.c +++ b/src/run/run.c @@ -488,10 +488,8 @@ static int start_transient_scope( return bus_log_create_error(r); if (arg_nice_set) { - if (setpriority(PRIO_PROCESS, 0, arg_nice) < 0) { - log_error("Failed to set nice level: %m"); - return -errno; - } + if (setpriority(PRIO_PROCESS, 0, arg_nice) < 0) + return log_error_errno(errno, "Failed to set nice level: %m"); } if (arg_exec_group) { @@ -501,10 +499,8 @@ static int start_transient_scope( if (r < 0) return log_error_errno(r, "Failed to resolve group %s: %m", arg_exec_group); - if (setresgid(gid, gid, gid) < 0) { - log_error("Failed to change GID to " GID_FMT ": %m", gid); - return -errno; - } + if (setresgid(gid, gid, gid) < 0) + return log_error_errno(errno, "Failed to change GID to " GID_FMT ": %m", gid); } if (arg_exec_user) { @@ -533,16 +529,12 @@ static int start_transient_scope( return log_oom(); if (!arg_exec_group) { - if (setresgid(gid, gid, gid) < 0) { - log_error("Failed to change GID to " GID_FMT ": %m", gid); - return -errno; - } + if (setresgid(gid, gid, gid) < 0) + return log_error_errno(errno, "Failed to change GID to " GID_FMT ": %m", gid); } - if (setresuid(uid, uid, uid) < 0) { - log_error("Failed to change UID to " UID_FMT ": %m", uid); - return -errno; - } + if (setresuid(uid, uid, uid) < 0) + return log_error_errno(errno, "Failed to change UID to " UID_FMT ": %m", uid); } env = strv_env_merge(3, environ, user_env, arg_environment); @@ -552,7 +544,7 @@ static int start_transient_scope( log_info("Running as unit %s.", name); execvpe(argv[0], argv, env); - log_error("Failed to execute: %m"); + log_error_errno(errno, "Failed to execute: %m"); return -errno; }