]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shutdown: fix up return type of sync_making_progress()
authorLennart Poettering <lennart@poettering.net>
Tue, 5 Mar 2019 10:52:54 +0000 (11:52 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 5 Mar 2019 11:21:17 +0000 (12:21 +0100)
We shouldn't return negative errnos as "bool", hence fix the type of the
function to "int".

src/core/shutdown.c

index 56e9a2480ae046f0b3cd6b33f55974d6aa744717..48469103da5994b6d7abec6430672b0058a2bc53 100644 (file)
@@ -169,10 +169,10 @@ static int switch_root_initramfs(void) {
  * value input. For all other issues, report the failure and indicate that
  * the sync is not making progress.
  */
-static bool sync_making_progress(unsigned long long *prev_dirty) {
+static int sync_making_progress(unsigned long long *prev_dirty) {
         _cleanup_fclose_ FILE *f = NULL;
         unsigned long long val = 0;
-        bool r = false;
+        int ret;
 
         f = fopen("/proc/meminfo", "re");
         if (!f)
@@ -205,11 +205,9 @@ static bool sync_making_progress(unsigned long long *prev_dirty) {
                 val += ull;
         }
 
-        r = *prev_dirty > val;
-
+        ret = *prev_dirty > val;
         *prev_dirty = val;
-
-        return r;
+        return ret;
 }
 
 static void sync_with_progress(void) {
@@ -243,7 +241,7 @@ static void sync_with_progress(void) {
                 else if (r == -ETIMEDOUT) {
                         /* Reset the check counter if the "Dirty" value is
                          * decreasing */
-                        if (sync_making_progress(&dirty))
+                        if (sync_making_progress(&dirty) > 0)
                                 checks = 0;
                 } else {
                         log_error_errno(r, "Failed to sync filesystems and block devices: %m");