imagex_export(): Check errno correctly
authorEric Biggers <ebiggers3@gmail.com>
Sat, 25 May 2013 16:40:32 +0000 (11:40 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 25 May 2013 16:40:32 +0000 (11:40 -0500)
programs/imagex.c

index 8f0f4b8..eeb7093 100644 (file)
@@ -2156,11 +2156,11 @@ imagex_export(int argc, tchar **argv)
                        goto out;
                }
        } else {
-               wim_is_new = true;
                /* dest_wimfile is not an existing file, so create a new WIM. */
-               if (!compression_type_specified)
-                       compression_type = wimlib_get_compression_type(src_w);
                if (errno == ENOENT) {
+                       wim_is_new = true;
+                       if (!compression_type_specified)
+                               compression_type = wimlib_get_compression_type(src_w);
                        ret = wimlib_create_new_wim(compression_type, &dest_w);
                        if (ret != 0)
                                goto out;