From: Lennart Poettering Date: Fri, 29 Dec 2017 17:12:30 +0000 (+0100) Subject: tree-wide: use EXIT_SUCCESS when comparing child process exit statuses X-Git-Tag: v237~146^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4a343112e465be168e6f868003e3e6c9cc4dae7;p=thirdparty%2Fsystemd.git tree-wide: use EXIT_SUCCESS when comparing child process exit statuses When we check the exit status of a subprocess, let's compare it with EXIT_SUCCESS rather than 0 when looking for success. This clarifies in code what kind of variable we are looking at and what we are doing. --- diff --git a/src/import/pull-common.c b/src/import/pull-common.c index e290b940202..ecdcbd2dc22 100644 --- a/src/import/pull-common.c +++ b/src/import/pull-common.c @@ -546,7 +546,7 @@ int pull_verify(PullJob *main_job, pid = 0; if (r < 0) goto finish; - if (r > 0) { + if (r != EXIT_SUCCESS) { log_error("DOWNLOAD INVALID: Signature verification failed."); r = -EBADMSG; } else { diff --git a/src/import/pull-tar.c b/src/import/pull-tar.c index a6fb0d49534..6ee63bdad58 100644 --- a/src/import/pull-tar.c +++ b/src/import/pull-tar.c @@ -337,7 +337,7 @@ static void tar_pull_job_on_finished(PullJob *j) { i->tar_pid = 0; if (r < 0) goto finish; - if (r > 0) { + if (r != EXIT_SUCCESS) { r = -EIO; goto finish; } diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 4e892c20a3d..1376497f8dc 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -6132,7 +6132,7 @@ static int enable_sysv_units(const char *verb, char **args) { if (j < 0) return j; if (streq(verb, "is-enabled")) { - if (j == 0) { + if (j == EXIT_SUCCESS) { if (!arg_quiet) puts("enabled"); r = 1; @@ -6141,7 +6141,7 @@ static int enable_sysv_units(const char *verb, char **args) { puts("disabled"); } - } else if (j != 0) + } else if (j != EXIT_SUCCESS) return -EBADE; /* We don't warn here, under the assumption the script already showed an explanation */ if (found_native)