+ /* Here we may re-order the extraction of multiple names (hard links)
+ * for the same file in the same directory in order to ensure the short
+ * (DOS) name is set correctly. A short name is always associated with
+ * exactly one long name, and at least on NTFS, only one long name for a
+ * file can have a short name associated with it. (More specifically,
+ * there can be unlimited names in the POSIX namespace, but only one
+ * name can be in the Win32+DOS namespace, or one name in the Win32
+ * namespace with a corresponding name in the DOS namespace.) To ensure
+ * the short name of a file is associated with the correct long name in
+ * a directory, we extract the long name with a corresponding short name
+ * before any additional names. This can affect NTFS-3g extraction
+ * (which uses ntfs_set_ntfs_dos_name(), which doesn't allow specifying
+ * the long name to associate with a short name) and may affect Win32
+ * extraction as well (which uses SetFileShortName()). */
+
+ if (dentry->skeleton_extracted)
+ return 0;
+ orig_dentry = NULL;
+ if (ctx->supported_features.short_names
+ && !dentry_has_short_name(dentry)
+ && !dentry->d_inode->i_dos_name_extracted)
+ {
+ inode_for_each_dentry(other_dentry, dentry->d_inode) {
+ if (dentry_has_short_name(other_dentry)
+ && !other_dentry->skeleton_extracted
+ && other_dentry->parent == dentry->parent)
+ {
+ DEBUG("Creating %"TS" before %"TS" "
+ "to guarantee correct DOS name extraction",
+ dentry_full_path(other_dentry),
+ dentry_full_path(dentry));
+ orig_dentry = dentry;
+ dentry = other_dentry;
+ break;
+ }
+ }
+ }
+again: