[PATCH 19/33] resizepart: check writing to a file descriptor was successful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 disk-utils/resizepart.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/disk-utils/resizepart.c b/disk-utils/resizepart.c
index 5517c4f..765e3a4 100644
--- a/disk-utils/resizepart.c
+++ b/disk-utils/resizepart.c
@@ -11,6 +11,7 @@
 #include "partx.h"
 #include "sysfs.h"
 #include "strutils.h"
+#include "closestream.h"
 
 static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
@@ -73,6 +74,7 @@ int main(int argc, char **argv)
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
+	atexit(close_stdout);
 
 	while ((c = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
 		switch (c) {
@@ -102,5 +104,8 @@ int main(int argc, char **argv)
 			strtou64_or_err(argv[3], _("invalid length argument"))))
 		err(EXIT_FAILURE, _("failed to resize partition"));
 
+	if (close_fd(fd) != 0)
+		err(EXIT_FAILURE, _("write failed"));
+
 	return 0;
 }
-- 
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux