diff --git a/disk-utils/blockdev.c b/disk-utils/blockdev.c index 2275f0c58..ba06ad035 100644 --- a/disk-utils/blockdev.c +++ b/disk-utils/blockdev.c @@ -15,6 +15,7 @@ #include "nls.h" #include "blkdev.h" #include "pathnames.h" +#include "closestream.h" struct bdc { long ioc; /* ioctl code */ @@ -221,6 +222,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); if (argc < 2) usage(stderr); diff --git a/disk-utils/elvtune.c b/disk-utils/elvtune.c index 7c074ffa6..9f7fbf327 100644 --- a/disk-utils/elvtune.c +++ b/disk-utils/elvtune.c @@ -38,6 +38,7 @@ #include #include "nls.h" #include "blkdev.h" +#include "closestream.h" #include "linux_version.h" /* this has to match with the kernel structure */ @@ -79,6 +80,7 @@ main(int argc, char * argv[]) { setlocale(LC_MESSAGES, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); for (;;) { int opt; diff --git a/disk-utils/fdformat.c b/disk-utils/fdformat.c index 29782ec9a..ec2f6170e 100644 --- a/disk-utils/fdformat.c +++ b/disk-utils/fdformat.c @@ -12,6 +12,7 @@ #include #include "c.h" +#include "closestream.h" #include "nls.h" #include "xalloc.h" @@ -119,6 +120,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); while ((ch = getopt_long(argc, argv, "nVh", longopts, NULL)) != -1) switch (ch) { diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c index a019a6979..a52eebc26 100644 --- a/disk-utils/fsck.c +++ b/disk-utils/fsck.c @@ -52,6 +52,7 @@ #include "pathnames.h" #include "exitcodes.h" #include "c.h" +#include "closestream.h" #define XALLOC_EXIT_CODE FSCK_EX_ERROR #include "xalloc.h" @@ -1479,6 +1480,7 @@ int main(int argc, char *argv[]) setlocale(LC_CTYPE, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); mnt_init_debug(0); /* init libmount debug mask */ mntcache = mnt_new_cache(); /* no fatal error if failed */ diff --git a/disk-utils/fsck.cramfs.c b/disk-utils/fsck.cramfs.c index 036f2c7c0..9d7256c21 100644 --- a/disk-utils/fsck.cramfs.c +++ b/disk-utils/fsck.cramfs.c @@ -59,6 +59,7 @@ #include "blkdev.h" #include "c.h" #include "exitcodes.h" +#include "closestream.h" #define XALLOC_EXIT_CODE FSCK_EX_ERROR #include "xalloc.h" @@ -644,6 +645,7 @@ int main(int argc, char **argv) setlocale(LC_MESSAGES, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); page_size = getpagesize(); diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c index 2a39e5be4..8b3ce62fa 100644 --- a/disk-utils/fsck.minix.c +++ b/disk-utils/fsck.minix.c @@ -110,6 +110,7 @@ #include "bitops.h" #include "ismounted.h" #include "writeall.h" +#include "closestream.h" #define ROOT_INO 1 #define YESNO_LENGTH 64 @@ -1242,6 +1243,7 @@ main(int argc, char **argv) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); if (argc == 2 && (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) { diff --git a/disk-utils/isosize.c b/disk-utils/isosize.c index 7bfa81d4a..7a8d71301 100644 --- a/disk-utils/isosize.c +++ b/disk-utils/isosize.c @@ -28,6 +28,7 @@ #include "nls.h" #include "c.h" #include "strutils.h" +#include "closestream.h" #define ISODCL(from, to) (to - from + 1) @@ -181,6 +182,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); while ((opt = getopt_long(argc, argv, "d:xVh", longopts, NULL)) != -1) switch (opt) { diff --git a/disk-utils/mkfs.bfs.c b/disk-utils/mkfs.bfs.c index 6e5f012e8..b37a94729 100644 --- a/disk-utils/mkfs.bfs.c +++ b/disk-utils/mkfs.bfs.c @@ -16,6 +16,7 @@ #include "blkdev.h" #include "c.h" +#include "closestream.h" #include "nls.h" #include "strutils.h" #include "xalloc.h" @@ -118,6 +119,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); if (argc < 2) usage(stderr); diff --git a/disk-utils/mkfs.c b/disk-utils/mkfs.c index ce845a571..dc2d2fdd9 100644 --- a/disk-utils/mkfs.c +++ b/disk-utils/mkfs.c @@ -21,6 +21,7 @@ #include #include "c.h" +#include "closestream.h" #include "nls.h" #include "xalloc.h" @@ -80,6 +81,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); if (argc == 2 && !strcmp(argv[1], "-V")) print_version(); diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c index 9777eaf97..8e38a8c89 100644 --- a/disk-utils/mkfs.cramfs.c +++ b/disk-utils/mkfs.cramfs.c @@ -40,6 +40,7 @@ #include "c.h" #include "cramfs.h" +#include "closestream.h" #include "md5.h" #include "nls.h" #include "exitcodes.h" @@ -718,6 +719,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); /* command line options */ while ((c = getopt(argc, argv, "hb:Ee:i:n:N:psVvz")) != EOF) { diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c index a1ec2960c..051cd5f68 100644 --- a/disk-utils/mkfs.minix.c +++ b/disk-utils/mkfs.minix.c @@ -85,6 +85,7 @@ #include "exitcodes.h" #include "strutils.h" #include "writeall.h" +#include "closestream.h" #define MINIX_ROOT_INO 1 #define MINIX_BAD_INO 2 @@ -660,6 +661,7 @@ int main(int argc, char ** argv) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); if (argc == 2 && (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) { diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index b963da265..51a0c890b 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -57,6 +57,7 @@ #include "writeall.h" #include "xalloc.h" #include "c.h" +#include "closestream.h" #ifdef HAVE_LIBUUID # include @@ -496,6 +497,7 @@ main(int argc, char **argv) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); while((c = getopt_long(argc, argv, "cfp:L:v:U:Vh", longopts, NULL)) != -1) { switch (c) { diff --git a/disk-utils/raw.c b/disk-utils/raw.c index 0a43c907c..1e7a6fbd7 100644 --- a/disk-utils/raw.c +++ b/disk-utils/raw.c @@ -24,6 +24,7 @@ #include #include "c.h" +#include "closestream.h" #include "nls.h" #include "pathnames.h" @@ -106,6 +107,7 @@ int main(int argc, char *argv[]) setlocale(LC_MESSAGES, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); while ((c = getopt_long(argc, argv, "qaVh", longopts, NULL)) != -1) switch (c) { diff --git a/disk-utils/swaplabel.c b/disk-utils/swaplabel.c index cc9a1e6aa..716db9e50 100644 --- a/disk-utils/swaplabel.c +++ b/disk-utils/swaplabel.c @@ -26,6 +26,7 @@ #endif #include "c.h" +#include "closestream.h" #include "writeall.h" #include "swapheader.h" #include "strutils.h" @@ -183,6 +184,7 @@ int main(int argc, char *argv[]) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); while ((c = getopt_long(argc, argv, "hVL:U:", longopts, NULL)) != -1) { switch (c) {