[PATCH 32/33] swapon: check writing to a file descriptor was successful

Sami Kerola
2013-04-13T19:56:37Z

sys-utils/swapon.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
index d5b7e37..f1e2433 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;
}

--
1.8.2.1