X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=programs%2Fimagex.c;h=7dbbc8a4330addd60c8a1f668d62853996ff4e37;hb=5caa3dfded8e0f590112b59feeb3b55e4fa28420;hp=c5a653a68e002cd34ce32057defc4f55a1e49a82;hpb=bbe43744afc43b836e8c24250ea70e59b1ff137a;p=wimlib
diff --git a/programs/imagex.c b/programs/imagex.c
index c5a653a6..7dbbc8a4 100644
--- a/programs/imagex.c
+++ b/programs/imagex.c
@@ -22,7 +22,10 @@
* along with this program. If not, see .
*/
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h" /* Need for PACKAGE_VERSION, etc. */
+#endif
+
#include "wimlib.h"
#include "wimlib_tchar.h"
@@ -40,7 +43,7 @@
#include
#ifdef HAVE_ALLOCA_H
-#include
+# include
#endif
#ifdef __WIN32__
@@ -80,7 +83,7 @@ enum imagex_op_type {
};
static void usage(int cmd_type);
-static void usage_all();
+static void usage_all(void);
static bool imagex_be_quiet = false;
@@ -2781,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]);
@@ -2984,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;
@@ -3110,7 +3122,7 @@ static const struct imagex_command imagex_commands[] = {
};
static void
-version()
+version(void)
{
static const tchar *s =
T(
@@ -3173,7 +3185,7 @@ usage(int cmd_type)
}
static void
-usage_all()
+usage_all(void)
{
tfputs(T("Usage:\n"), stdout);
for (int i = 0; i < ARRAY_LEN(usage_strings); i++)