]> wimlib.net Git - wimlib/blobdiff - src/ntfs-3g_apply.c
ntfs-3g_apply.c: Only warn when DOS names cannot be applied
[wimlib] / src / ntfs-3g_apply.c
index dde9a1db3ecfde9fa1f48ee514fa8f31406d93de..4e5926bcc71f21ea0fad433e043b33095b8e0abc 100644 (file)
@@ -305,7 +305,7 @@ apply_file_attributes_and_security_data(ntfs_inode *ni,
 {
        int ret;
        struct SECURITY_CONTEXT ctx;
-       u32 attributes_le32;
+       le32 attributes;
        const struct wim_inode *inode;
 
        inode = dentry->d_inode;
@@ -313,13 +313,13 @@ apply_file_attributes_and_security_data(ntfs_inode *ni,
        DEBUG("Setting NTFS file attributes on `%s' to %#"PRIx32,
              dentry->_full_path, inode->i_attributes);
 
-       attributes_le32 = cpu_to_le32(inode->i_attributes);
+       attributes = cpu_to_le32(inode->i_attributes);
        memset(&ctx, 0, sizeof(ctx));
        ctx.vol = ni->vol;
        ret = ntfs_xattr_system_setxattr(&ctx, XATTR_NTFS_ATTRIB,
                                         ni, dir_ni,
-                                        (const char*)&attributes_le32,
-                                        sizeof(u32), 0);
+                                        (char*)&attributes,
+                                        sizeof(attributes), 0);
        if (ret) {
                ERROR("Failed to set NTFS file attributes on `%s'",
                      dentry->_full_path);
@@ -458,7 +458,8 @@ do_apply_dentry_ntfs(struct wim_dentry *dentry, ntfs_inode *dir_ni,
        }
 
        /* Set DOS (short) name if given */
-       if (dentry_has_short_name(dentry)) {
+       if (dentry_has_short_name(dentry) && !dentry->dos_name_invalid)
+       {
                char *short_name_mbs;
                size_t short_name_mbs_nbytes;
                ret = utf16le_to_tstr(dentry->short_name,
@@ -475,9 +476,9 @@ do_apply_dentry_ntfs(struct wim_dentry *dentry, ntfs_inode *dir_ni,
                                             short_name_mbs_nbytes, 0);
                FREE(short_name_mbs);
                if (ret) {
-                       ERROR_WITH_ERRNO("Could not set DOS (short) name for `%s'",
-                                        dentry->_full_path);
-                       ret = WIMLIB_ERR_NTFS_3G;
+                       WARNING_WITH_ERRNO("Could not set DOS (short) name for `%s'",
+                                          dentry->_full_path);
+                       ret = 0;
                }
                /* inodes have been closed by ntfs_set_ntfs_dos_name(). */
                goto out;
@@ -512,6 +513,10 @@ apply_root_dentry_ntfs(struct wim_dentry *dentry,
        ntfs_inode *ni;
        int ret = 0;
 
+       ret = calculate_dentry_full_path(dentry);
+       if (ret)
+               return ret;
+
        ni = ntfs_pathname_to_inode(vol, NULL, "/");
        if (!ni) {
                ERROR_WITH_ERRNO("Could not find root NTFS inode");
@@ -593,10 +598,10 @@ apply_dentry_ntfs(struct wim_dentry *dentry, void *arg)
 again:
        orig_dentry = NULL;
        if (!dentry->d_inode->i_dos_name_extracted &&
-           !dentry_has_short_name(dentry))
+           (!dentry_has_short_name(dentry) || dentry->dos_name_invalid))
        {
                inode_for_each_dentry(other, dentry->d_inode) {
-                       if (dentry_has_short_name(other)) {
+                       if (dentry_has_short_name(other) && !other->dos_name_invalid) {
                                orig_dentry = dentry;
                                dentry = other;
                                break;
@@ -604,6 +609,11 @@ again:
                }
        }
        dentry->d_inode->i_dos_name_extracted = 1;
+
+       ret = calculate_dentry_full_path(dentry);
+       if (ret)
+               return ret;
+
        ntfs_inode *dir_ni = dentry_open_parent_ni(dentry, vol);
        if (dir_ni) {
                ret = do_apply_dentry_ntfs(dentry, dir_ni, arg);