From: Eric Biggers Date: Wed, 15 May 2013 02:59:34 +0000 (-0500) Subject: imagex_optimize(), imagex_update(): Check if file writable first X-Git-Tag: v1.4.0~43 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=4a6a0f1a87bdf6726c92f4dad0801fe4313773f3 imagex_optimize(), imagex_update(): Check if file writable first --- diff --git a/programs/imagex.c b/programs/imagex.c index b45d2d4b..7dbbc8a4 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -2784,9 +2784,13 @@ imagex_optimize(int argc, tchar **argv) wimfile = argv[0]; + ret = file_writable(wimfile); + if (ret) + return ret; + ret = wimlib_open_wim(wimfile, open_flags, &w, imagex_progress_func); - if (ret != 0) + if (ret) return ret; old_size = file_get_size(argv[0]); @@ -2987,6 +2991,11 @@ imagex_update(int argc, tchar **argv) if (argc < 1 || argc > 2) goto out_usage; wimfile = argv[0]; + + ret = file_writable(wimfile); + if (ret) + goto out; + ret = wimlib_open_wim(wimfile, open_flags, &wim, imagex_progress_func); if (ret) goto out;