]> wimlib.net Git - wimlib/commitdiff
wimlib_mount(): Disallow mounting newly added image
authorEric Biggers <ebiggers3@gmail.com>
Mon, 12 Nov 2012 22:56:51 +0000 (16:56 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 12 Nov 2012 22:56:51 +0000 (16:56 -0600)
src/mount.c
src/wimlib.h

index 4dc28f1fbc2c8fee36904530dff7c565b44c5d81..27f6551aab8f37800a2c8fe28dc5a5c1d494b156 100644 (file)
@@ -1880,7 +1880,14 @@ WIMLIBAPI int wimlib_mount(WIMStruct *wim, int image, const char *dir,
 
        if (imd->root_dentry->refcnt != 1) {
                ERROR("Cannot mount image that was just exported with "
-                     "wimlib_export()");
+                     "wimlib_export_image()");
+               ret = WIMLIB_ERR_INVALID_PARAM;
+               goto out;
+       }
+
+       if (imd->modified) {
+               ERROR("Cannot mount image that was added "
+                     "with wimlib_add_image()");
                ret = WIMLIB_ERR_INVALID_PARAM;
                goto out;
        }
index 8c133a261cca606e45c8b5e84119cdb60830759a..a8b07ac08b2a0f89cce35056ed73d9d37e796562 100644 (file)
@@ -914,7 +914,10 @@ extern int wimlib_join(const char **swms, unsigned num_swms,
  *
  * wimlib_mount() cannot be used on an image that was exported with
  * wimlib_export_image() while the dentry trees for both images are still in
- * memory.
+ * memory.  In addition, wimlib_mount() may not be used to mount an image that
+ * has just been added with wimlib_add_image() or
+ * wimlib_add_image_from_ntfs_volume(), unless the WIM has been written and read
+ * into a new ::WIMStruct.
  *
  * @param wim
  *     Pointer to the ::WIMStruct for the WIM file to be mounted.
@@ -954,7 +957,8 @@ extern int wimlib_join(const char **swms, unsigned num_swms,
  *     @a image does not specify an existing, single image in @a wim.
  * @retval ::WIMLIB_ERR_INVALID_PARAM
  *     @a image is shared among multiple ::WIMStruct's as a result of a call to
- *     wimlib_export_image().
+ *     wimlib_export_image(), or @a image has been added with
+ *     wimlib_add_image() or wimlib_add_image_from_ntfs_volume().
  * @retval ::WIMLIB_ERR_INVALID_RESOURCE_SIZE
  *     The metadata resource for @a image in @a wim is invalid.
  * @retval ::WIMLIB_ERR_INVALID_SECURITY_DATA