]> err.no Git - util-linux/commitdiff
swapon: add error messages for lseek and write
authorKarel Zak <kzak@redhat.com>
Thu, 5 Mar 2009 19:59:30 +0000 (20:59 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 5 Mar 2009 19:59:30 +0000 (20:59 +0100)
Thanks to Hugh Dickins.

Signed-off-by: Karel Zak <kzak@redhat.com>
mount/swapon.c

index e342293d7da0a799f8ea5446a755772bc3422a04..55933b1013d962c8eface80d94739df564df2e70 100644 (file)
@@ -246,12 +246,16 @@ swap_rewrite_signature(const char *devname, unsigned int pagesize)
                return -1;
        }
 
-       if (lseek(fd, pagesize - SWAP_SIGNATURE_SZ, SEEK_SET) < 0)
+       if (lseek(fd, pagesize - SWAP_SIGNATURE_SZ, SEEK_SET) < 0) {
+               warn(_("%s: lseek failed"), devname);
                goto err;
+       }
 
        if (write(fd, (void *) SWAP_SIGNATURE,
-                       SWAP_SIGNATURE_SZ) != SWAP_SIGNATURE_SZ)
+                       SWAP_SIGNATURE_SZ) != SWAP_SIGNATURE_SZ) {
+               warn(_("%s: write signature failed"), devname);
                goto err;
+       }
 
        rc  = 0;
 err: