Honor WIM_HDR_FLAG_READONLY
authorEric Biggers <ebiggers3@gmail.com>
Wed, 22 May 2013 00:37:37 +0000 (19:37 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Wed, 22 May 2013 00:37:37 +0000 (19:37 -0500)
include/wimlib.h
src/util.c
src/wim.c

index c1c00e4..b7a21cf 100644 (file)
@@ -1022,6 +1022,7 @@ enum wimlib_error_code {
        WIMLIB_ERR_VOLUME_LACKS_FEATURES,
        WIMLIB_ERR_WRITE,
        WIMLIB_ERR_XML,
+       WIMLIB_ERR_WIM_IS_MARKED_READONLY,
 };
 
 
index 6b93e2a..87dd3c5 100644 (file)
@@ -389,6 +389,8 @@ static const tchar *error_strings[] = {
                = T("The requested operation is unsupported"),
        [WIMLIB_ERR_VOLUME_LACKS_FEATURES]
                = T("The volume did not support a feature necessary to complete the operation"),
+       [WIMLIB_ERR_WIM_IS_MARKED_READONLY]
+               = T("The WIM is marked as read-only"),
        [WIMLIB_ERR_WRITE]
                = T("Failed to write data to a file"),
        [WIMLIB_ERR_XML]
index 9e73c76..4a8e6a8 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -676,12 +676,15 @@ int
 can_modify_wim(WIMStruct *wim)
 {
        if (wim->hdr.total_parts != 1) {
-               if (wim->filename)
-                       ERROR("Cannot modify \"%"TS"\": is a split WIM!", wim->filename);
-               else
-                       ERROR("Cannot modify a split WIM!");
+               ERROR("Cannot modify \"%"TS"\": is part of a spanned set",
+                     wim->filename);
                return WIMLIB_ERR_SPLIT_UNSUPPORTED;
        }
+       if (wim->hdr.flags & WIM_HDR_FLAG_READONLY) {
+               ERROR("Cannot modify \"%"TS"\": is marked read-only",
+                     wim->filename);
+               return WIMLIB_ERR_WIM_IS_MARKED_READONLY;
+       }
        return 0;
 }