]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_io: syncfs can fail
authorJeff Layton <jlayton@redhat.com>
Thu, 24 May 2018 19:48:39 +0000 (14:48 -0500)
committerEric Sandeen <sandeen@redhat.com>
Thu, 24 May 2018 19:48:39 +0000 (14:48 -0500)
syncfs can return an error. Report one if it does. Also, ensure that
xfs_io will exit with a non-zero status in that case.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/sync.c

index c77263804a3536dcf19b46321a37d72ca615d215..20ab50a7fcd433dd6558486f26e90de93fd4b3e0 100644 (file)
--- a/io/sync.c
+++ b/io/sync.c
@@ -41,8 +41,10 @@ syncfs_f(
        int                     argc,
        char                    **argv)
 {
-       /* syncfs can't fail */
-       syncfs(file->fd);
+       if (syncfs(file->fd) < 0) {
+               perror("syncfs");
+               exitcode = 1;
+       }
        return 0;
 }
 #endif