]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
swapon: check writing to a file descriptor was successful
authorSami Kerola <kerolasa@iki.fi>
Sat, 13 Apr 2013 19:55:00 +0000 (20:55 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 26 Apr 2013 11:26:07 +0000 (13:26 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/swapon.c

index d5b7e378964d03fc9d30175c5a3c334307733ca7..f1e2433755a10a884470059b3a89aec7a8e6cfe2 100644 (file)
@@ -323,7 +323,10 @@ static int swap_rewrite_signature(const char *devname, unsigned int pagesize)
 
        rc  = 0;
 err:
-       close(fd);
+       if (close_fd(fd) != 0) {
+               warn(_("write failed: %s"), devname);
+               rc = -1;
+       }
        return rc;
 }