]> wimlib.net Git - wimlib/blobdiff - src/xml.c
export_image.c: adjust error message
[wimlib] / src / xml.c
index ecb73b221454227e2175abfa1fa888438f0cde93..4617e2ab4cbd6fa8a3e1bec379ccb33e6e1fcfd7 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -1241,7 +1241,7 @@ calculate_dentry_statistics(struct wim_dentry *dentry, void *arg)
 
 /*
  * Calculate what to put in the <FILECOUNT>, <DIRCOUNT>, <TOTALBYTES>, and
- * <HARDLINKBYTES> elements of each <IMAGE>.
+ * <HARDLINKBYTES> elements of the specified WIM image.
  */
 void
 xml_update_image_info(WIMStruct *wim, int image)
@@ -1668,23 +1668,18 @@ wimlib_set_image_name(WIMStruct *wim, int image, const tchar *name)
        tchar *p;
        int i;
 
-       DEBUG("Setting the name of image %d to %"TS, image, name);
-
        if (name == NULL)
                name = T("");
 
-       if (image < 1 || image > wim->hdr.image_count) {
-               ERROR("%d is not a valid image", image);
+       if (image < 1 || image > wim->hdr.image_count)
                return WIMLIB_ERR_INVALID_IMAGE;
-       }
 
-       for (i = 1; i <= wim->hdr.image_count; i++) {
-               if (i == image)
-                       continue;
-               if (!tstrcmp(wim->wim_info->images[i - 1].name, name)) {
-                       ERROR("The name \"%"TS"\" is already in use in the WIM!",
-                             name);
-                       return WIMLIB_ERR_IMAGE_NAME_COLLISION;
+       if (*name) {
+               for (i = 1; i <= wim->hdr.image_count; i++) {
+                       if (i == image)
+                               continue;
+                       if (!tstrcmp(wim->wim_info->images[i - 1].name, name))
+                               return WIMLIB_ERR_IMAGE_NAME_COLLISION;
                }
        }