]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: verify writing to streams was successful
authorSami Kerola <kerolasa@iki.fi>
Wed, 4 Apr 2012 18:02:04 +0000 (20:02 +0200)
committerSami Kerola <kerolasa@iki.fi>
Wed, 4 Apr 2012 18:02:04 +0000 (20:02 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
fdisk/cfdisk.c
fdisk/fdisk.c
fdisk/gpt.c
fdisk/partitiontype.c
fdisk/sfdisk.c

index a128ed75738f64b508975ae8239e9bba76f3e7d5..a6cf01e5c7dcac082c7b86a67b083c3e86ab4b0b 100644 (file)
@@ -97,6 +97,7 @@
 #include <wctype.h>
 #endif
 
+#include "closestream.h"
 #include "nls.h"
 #include "rpmatch.h"
 #include "blkdev.h"
@@ -2767,6 +2768,7 @@ main(int argc, char **argv)
     setlocale(LC_ALL, "");
     bindtextdomain(PACKAGE, LOCALEDIR);
     textdomain(PACKAGE);
+    atexit(close_stdout);
 
     while ((c = getopt(argc, argv, "ac:gh:s:vzP:")) != -1)
        switch (c) {
index 8893a017493991ed1a74279aa73f4477815c12e8..4fc347b1fedaad37bc4576c67557eb3050c2bcb2 100644 (file)
@@ -33,6 +33,7 @@
 #include "pathnames.h"
 #include "canonicalize.h"
 #include "strutils.h"
+#include "closestream.h"
 
 #include "fdisksunlabel.h"
 #include "fdisksgilabel.h"
@@ -2958,6 +2959,7 @@ main(int argc, char **argv) {
        setlocale(LC_ALL, "");
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
+       atexit(close_stdout);
 
        while ((c = getopt(argc, argv, "b:c::C:hH:lsS:u::vV")) != -1) {
                switch (c) {
index aeacd662456997f3251d13bdac48fa63987aca83..bb6911a218d37fd02e5275490f1204a7d0e9ca6b 100644 (file)
@@ -39,6 +39,7 @@
 #include "gpt.h"
 #include "blkdev.h"
 #include "bitops.h"
+#include "closestream.h"
 
 #define GPT_HEADER_SIGNATURE 0x5452415020494645LL
 #define GPT_PRIMARY_PARTITION_TABLE_LBA 1
@@ -202,6 +203,7 @@ gpt_probe_signature_devname(char *devname)
 int
 main(int argc, char **argv)
 {
+       atexit(close_stdout);
        if (argc!=2)
        {
                fprintf(stderr, "usage: %s <dev>\n", argv[0]);
index 0ee44a0bab32a640140e5e5bce3048bed93c3aa6..02a22a5957996a55b3e48d57412c519014b38c51 100644 (file)
@@ -10,6 +10,8 @@
 #include <fcntl.h>
 #include <stdlib.h>
 
+#include "closestream.h"
+
 struct aix_label {
        unsigned int   magic;
        /* more ... */
@@ -53,6 +55,7 @@ main(int argc, char **argv) {
        struct sgi_label *psgi;
        struct sun_label *psun;
 
+       atexit(close_stdout);
        if (argc != 2) {
                fprintf(stderr, "call: %s device\n", argv[0]);
                exit(1);
index a090772a86614c5b1ec7133aab99f97301489bde..f0ce08bcb862201619f35ce389a2ddf56b71a1ed 100644 (file)
@@ -54,6 +54,7 @@
 #include "pathnames.h"
 #include "canonicalize.h"
 #include "rpmatch.h"
+#include "closestream.h"
 
 /*
  * Table of contents:
@@ -2572,6 +2573,7 @@ main(int argc, char **argv) {
     setlocale(LC_ALL, "");
     bindtextdomain(PACKAGE, LOCALEDIR);
     textdomain(PACKAGE);
+    atexit(close_stdout);
 
     if (argc < 1)
        errx(EXIT_FAILURE, _("no command?"));