summaryrefslogtreecommitdiff
path: root/src/shared/util.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2014-11-28 18:50:43 +0100
committerMichal Schmidt <mschmidt@redhat.com>2014-11-28 18:56:16 +0100
commitf647962d64e844689f3e2acfce6102fc47e76df2 (patch)
treedcaf5e38de1d4e31f73f540bc85532ceb72cfa6b /src/shared/util.c
parente80733be33e52d8ab2f1ae845326d39c600f5612 (diff)
treewide: yet more log_*_errno + return simplifications
Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
Diffstat (limited to 'src/shared/util.c')
-rw-r--r--src/shared/util.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 646787cd79..74dd4b7f4e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3795,10 +3795,8 @@ int wait_for_terminate_and_warn(const char *name, pid_t pid) {
assert(pid > 1);
r = wait_for_terminate(pid, &status);
- if (r < 0) {
- log_warning_errno(r, "Failed to wait for %s: %m", name);
- return r;
- }
+ if (r < 0)
+ return log_warning_errno(r, "Failed to wait for %s: %m", name);
if (status.si_code == CLD_EXITED) {
if (status.si_status != 0) {
@@ -5506,16 +5504,12 @@ int make_console_stdio(void) {
/* Make /dev/console the controlling terminal and stdin/stdout/stderr */
fd = acquire_terminal("/dev/console", false, true, true, USEC_INFINITY);
- if (fd < 0) {
- log_error_errno(fd, "Failed to acquire terminal: %m");
- return fd;
- }
+ if (fd < 0)
+ return log_error_errno(fd, "Failed to acquire terminal: %m");
r = make_stdio(fd);
- if (r < 0) {
- log_error_errno(r, "Failed to duplicate terminal fd: %m");
- return r;
- }
+ if (r < 0)
+ return log_error_errno(r, "Failed to duplicate terminal fd: %m");
return 0;
}