]> wimlib.net Git - wimlib/commitdiff
wimlib-imagex: forbid --unsafe-compact when it doesn't make sense
authorEric Biggers <ebiggers3@gmail.com>
Mon, 19 Oct 2015 00:39:30 +0000 (19:39 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 19 Oct 2015 00:48:25 +0000 (19:48 -0500)
programs/imagex.c

index 23f362b61f2beb524e3a53747cd34f94669cac2e..feb363043d527c55f5c917a7fbc2306b1e12fb61 100644 (file)
@@ -1958,6 +1958,11 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd)
                        add_flags |= WIMLIB_ADD_FLAG_WIMBOOT;
                        break;
                case IMAGEX_UNSAFE_COMPACT_OPTION:
+                       if (cmd != CMD_APPEND) {
+                               imagex_error(T("'--unsafe-compact' is only "
+                                              "valid for append!"));
+                               goto out_err;
+                       }
                        write_flags |= WIMLIB_WRITE_FLAG_UNSAFE_COMPACT;
                        break;
                default:
@@ -2941,6 +2946,13 @@ imagex_export(int argc, tchar **argv, int cmd)
                        goto out_free_src_wim;
                }
 
+               if (write_flags & WIMLIB_WRITE_FLAG_UNSAFE_COMPACT) {
+                       imagex_error(T("'--unsafe-compact' is only valid when "
+                                      "exporting to an existing WIM file!"));
+                       ret = -1;
+                       goto out_free_src_wim;
+               }
+
                /* dest_wimfile is not an existing file, so create a new WIM. */
 
                if (compression_type == WIMLIB_COMPRESSION_TYPE_INVALID) {