]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (gpt) don't ignore fsync() errors
authorKarel Zak <kzak@redhat.com>
Thu, 11 Aug 2022 11:09:05 +0000 (13:09 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 11 Aug 2022 11:09:05 +0000 (13:09 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/gpt.c

index 1fed8641f467968513da48b34154f21dc14ec815..8f9a0a1189a040b32ca54c296e0e6e37dfc78a57 100644 (file)
@@ -2045,7 +2045,8 @@ static int gpt_write(struct fdisk_context *cxt, off_t offset, void *buf, size_t
        if (write_all(cxt->dev_fd, buf, count))
                return -errno;
 
-       fsync(cxt->dev_fd);
+       if (fsync(cxt->dev_fd) != 0)
+               return -errno;
 
        DBG(GPT, ul_debug("  write OK [offset=%zu, size=%zu]",
                                (size_t) offset, count));