]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use EXIT_SUCCESS when comparing child process exit statuses
authorLennart Poettering <lennart@poettering.net>
Fri, 29 Dec 2017 17:12:30 +0000 (18:12 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 4 Jan 2018 12:27:27 +0000 (13:27 +0100)
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.

src/import/pull-common.c
src/import/pull-tar.c
src/systemctl/systemctl.c

index e290b9402026a4f74ec50f1e5562ec2afa50eecc..ecdcbd2dc22e9de9715e7e0e9ac479a4018e3715 100644 (file)
@@ -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 {
index a6fb0d49534ff09430e5420eb86a723f5e13f3b2..6ee63bdad583d7a1f468a2c1a6766cd763eacace 100644 (file)
@@ -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;
                 }
index 4e892c20a3dcff30f579fae1350626bb555571a0..1376497f8dc34a80b281bd30ef3e1973e36d6673 100644 (file)
@@ -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)