]> wimlib.net Git - wimlib/commitdiff
wimlib-imagex: Set stdout to binary mode when appropriate
authorEric Biggers <ebiggers3@gmail.com>
Sun, 18 Aug 2013 16:35:39 +0000 (11:35 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 18 Aug 2013 16:35:39 +0000 (11:35 -0500)
programs/imagex.c

index d005a12bd8f90fb7e26d2237a260acd2caa615c6..d6479b4fce86569ef2c37de9329d45937e1149b5 100644 (file)
@@ -1720,6 +1720,7 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd)
        wimfile = argv[1];
 
        if (!tstrcmp(wimfile, T("-"))) {
+               /* Writing captured WIM to standard output.  */
        #if 0
                if (!(write_flags & WIMLIB_WRITE_FLAG_PIPABLE)) {
                        imagex_error("Can't write a non-pipable WIM to "
@@ -1739,6 +1740,7 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd)
                wim_fd = STDOUT_FILENO;
                wimfile = NULL;
                imagex_info_file = stderr;
+               set_fd_to_binary_mode(wim_fd);
        }
 
        if (argc >= 3) {
@@ -2178,6 +2180,7 @@ imagex_export(int argc, tchar **argv, int cmd)
                dest_wimfile = NULL;
                dest_wim_fd = STDOUT_FILENO;
                imagex_info_file = stderr;
+               set_fd_to_binary_mode(dest_wim_fd);
        }
        errno = ENOENT;
        if (dest_wimfile != NULL && tstat(dest_wimfile, &stbuf) == 0) {