]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
disk-utils: verify writing to streams was successful
authorSami Kerola <kerolasa@iki.fi>
Wed, 4 Apr 2012 18:04:39 +0000 (20:04 +0200)
committerSami Kerola <kerolasa@iki.fi>
Wed, 4 Apr 2012 18:04:39 +0000 (20:04 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
14 files changed:
disk-utils/blockdev.c
disk-utils/elvtune.c
disk-utils/fdformat.c
disk-utils/fsck.c
disk-utils/fsck.cramfs.c
disk-utils/fsck.minix.c
disk-utils/isosize.c
disk-utils/mkfs.bfs.c
disk-utils/mkfs.c
disk-utils/mkfs.cramfs.c
disk-utils/mkfs.minix.c
disk-utils/mkswap.c
disk-utils/raw.c
disk-utils/swaplabel.c

index 2275f0c58fe785a89d3bb3ec488e25fab365b153..ba06ad0355b8af9c5bf431bada4a200857bba3e2 100644 (file)
@@ -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);
index 7c074ffa62fd722c476181dd8e2c62b73babd0d1..9f7fbf327fe540861f6c3cdab784cf25562b1ab0 100644 (file)
@@ -38,6 +38,7 @@
 #include <sys/utsname.h>
 #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;
index 29782ec9a0792180dfa7b659562a7e0bf340a06f..ec2f6170ebe6fee53ae68af76331df982013e813 100644 (file)
@@ -12,6 +12,7 @@
 #include <unistd.h>
 
 #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) {
index a019a6979bdee048f511448c80b158af352e7f62..a52eebc26f943e7abe0e46ad36bc6bccf1adf1f3 100644 (file)
@@ -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 */
index 036f2c7c02285db2b63148b616f7138206645884..9d7256c21de0dec921c013a9abeb0e7a04db88a5 100644 (file)
@@ -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();
 
index 2a39e5be40f52c7d590df2fd4e367f8476733d79..8b3ce62fa1716cbc1511f48d71abda1b2be0e2f8 100644 (file)
 #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"))) {
index 7bfa81d4ae7439d78bf6bf595e6ce2245e87fbd2..7a8d713018f04d36a04a1e95ca204db56cb5e22b 100644 (file)
@@ -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) {
index 6e5f012e893007616b0cf3040794e4383aade6ed..b37a947290974f7a5d06cce3aeb7f7c2a130be7b 100644 (file)
@@ -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);
index ce845a5715cc059e20a084814aa25d4e650d1e53..dc2d2fdd9ed9fc7ada8038d148405bc2b5889311 100644 (file)
@@ -21,6 +21,7 @@
 #include <unistd.h>
 
 #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();
index 9777eaf976b6472c1128f5098d19635079251f01..8e38a8c89ac24abcea858052fc271f80d95f2733 100644 (file)
@@ -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) {
index a1ec2960cc99d4dd5be85911c4459a37ffd63054..051cd5f6836c46602092c9feee4f0d9fcc734ca7 100644 (file)
@@ -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"))) {
index b963da265e67019ea67580e434ffa6f2d291b2af..51a0c890bd0791aaeed5248abb2362f017de25d0 100644 (file)
@@ -57,6 +57,7 @@
 #include "writeall.h"
 #include "xalloc.h"
 #include "c.h"
+#include "closestream.h"
 
 #ifdef HAVE_LIBUUID
 # include <uuid.h>
@@ -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) {
index 0a43c907c7814dca903f69a68953ccebc8fd19bb..1e7a6fbd7b898cbb0f40ca2eb6bb77fb84310384 100644 (file)
@@ -24,6 +24,7 @@
 #include <unistd.h>
 
 #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) {
index cc9a1e6aa37252c644dbcf29a76876065b698422..716db9e50c6425652bfb317b067b5d64de231561 100644 (file)
@@ -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) {