From: Sami Kerola Date: Sat, 13 Apr 2013 19:55:00 +0000 (+0100) Subject: swapon: check writing to a file descriptor was successful X-Git-Tag: v2.24-rc1~580 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14699715351070b8b6165d8780d7d5c1d3cdb5b1;p=thirdparty%2Futil-linux.git swapon: check writing to a file descriptor was successful Signed-off-by: Sami Kerola --- diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index d5b7e37896..f1e2433755 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -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; }