diff options
author | Sami Kerola | 2013-04-13 21:54:47 +0200 |
---|---|---|
committer | Karel Zak | 2013-04-26 13:26:06 +0200 |
commit | dd79e7c9d0f9c0d8a6c72a86a8a96b092d59bb45 (patch) | |
tree | 251ec0ade411dc7c77a7cee3a8f62812d37d2b68 /disk-utils/resizepart.c | |
parent | partx: check writing to a file descriptor was successful (diff) | |
download | kernel-qcow2-util-linux-dd79e7c9d0f9c0d8a6c72a86a8a96b092d59bb45.tar.gz kernel-qcow2-util-linux-dd79e7c9d0f9c0d8a6c72a86a8a96b092d59bb45.tar.xz kernel-qcow2-util-linux-dd79e7c9d0f9c0d8a6c72a86a8a96b092d59bb45.zip |
resizepart: check writing to a file descriptor was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'disk-utils/resizepart.c')
-rw-r--r-- | disk-utils/resizepart.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/disk-utils/resizepart.c b/disk-utils/resizepart.c index 5517c4ff2..765e3a406 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; } |