diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c index a128ed757..a6cf01e5c 100644 --- a/fdisk/cfdisk.c +++ b/fdisk/cfdisk.c @@ -97,6 +97,7 @@ #include #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) { diff --git a/fdisk/fdisk.c b/fdisk/fdisk.c index 8893a0174..4fc347b1f 100644 --- a/fdisk/fdisk.c +++ b/fdisk/fdisk.c @@ -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) { diff --git a/fdisk/gpt.c b/fdisk/gpt.c index aeacd6624..bb6911a21 100644 --- a/fdisk/gpt.c +++ b/fdisk/gpt.c @@ -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 \n", argv[0]); diff --git a/fdisk/partitiontype.c b/fdisk/partitiontype.c index 0ee44a0ba..02a22a595 100644 --- a/fdisk/partitiontype.c +++ b/fdisk/partitiontype.c @@ -10,6 +10,8 @@ #include #include +#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); diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index a090772a8..f0ce08bcb 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -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?"));