swapon: add error messages for lseek and write

Thanks to Hugh Dickins.

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2009-03-05 20:59:30 +01:00
parent 93bfcc94d3
commit 5dd53f43b2
1 changed files with 6 additions and 2 deletions

View 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: