]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
sync: fix open fallback bug
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 Nov 2018 18:35:16 +0000 (10:35 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 6 Nov 2018 18:35:31 +0000 (10:35 -0800)
Problem caught by Coverity Analysis
and reported by Kamil Dudka (Bug#33287).
* src/sync.c (sync_arg): Fix typo in fallback code.

src/sync.c

index bd3671a19c919519011c4bf977eea7672b6cd2b7..607fa8f7f42270697133d9d06556c8c4240bef0d 100644 (file)
@@ -111,8 +111,10 @@ sync_arg (enum sync_mode mode, char const *file)
       if (open_flags != (O_WRONLY | O_NONBLOCK))
         fd = open (file, O_WRONLY | O_NONBLOCK);
       if (fd < 0)
-        error (0, rd_errno, _("error opening %s"), quoteaf (file));
-      return false;
+        {
+          error (0, rd_errno, _("error opening %s"), quoteaf (file));
+          return false;
+        }
     }
 
   /* We used O_NONBLOCK above to not hang with fifos,