[PATCH 29/33] swaplabel: check writing to a file descriptor was successful

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

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

diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c
index 3e3e78b..a5ccb7e 100644
--- a/disk-utils/swaplabel.c
+++ b/disk-utils/swaplabel.c
@@ -145,7 +145,10 @@ static int change_info(const char *devname, const char *label, const char *uuid)
}
}

- close(fd);
+ if (close_fd(fd) != 0) {
+ warn(_("write failed: %s"), devname);
+ return -1;
+ }
return 0;
err:
if (fd >= 0)
--
1.8.2.1