]> wimlib.net Git - wimlib/commitdiff
Misc. fixes
authorEric Biggers <ebiggers3@gmail.com>
Sun, 28 Apr 2013 02:37:20 +0000 (21:37 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 28 Apr 2013 02:37:20 +0000 (21:37 -0500)
src/add_image.c
src/dentry.c
src/hardlink.c
src/reparse.c
src/wimlib_internal.h
src/win32.c

index d9e4ca293654ff3001b51fd5fc3bbbb85d9d5d0a..9bd597a131a1c9bdb71fff0a177b17b0f71d923c 100644 (file)
@@ -210,9 +210,9 @@ unix_capture_symlink(struct wim_dentry **root_p,
                if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_RPFIX) &&
                     dest[0] == '/')
                {
                if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_RPFIX) &&
                     dest[0] == '/')
                {
-                       dest = fixup_symlink(dest,
-                                            params->capture_root_ino,
-                                            params->capture_root_dev);
+                       dest = capture_fixup_absolute_symlink(dest,
+                                                             params->capture_root_ino,
+                                                             params->capture_root_dev);
                        if (!dest) {
                                WARNING("Ignoring out of tree absolute symlink "
                                        "\"%s\" -> \"%s\"\n"
                        if (!dest) {
                                WARNING("Ignoring out of tree absolute symlink "
                                        "\"%s\" -> \"%s\"\n"
index 7cd93ed1ab9e42a21aa0dfcaf6ae31d6e5e441c7..8f0ed20626493e4027852d117bb27ca14dac09ee 100644 (file)
@@ -711,6 +711,7 @@ new_timeless_inode()
                inode->i_nlink = 1;
                inode->i_next_stream_id = 1;
                inode->i_not_rpfixed = 1;
                inode->i_nlink = 1;
                inode->i_next_stream_id = 1;
                inode->i_not_rpfixed = 1;
+               INIT_LIST_HEAD(&inode->i_list);
        #ifdef WITH_FUSE
                if (pthread_mutex_init(&inode->i_mutex, NULL) != 0) {
                        ERROR_WITH_ERRNO("Error initializing mutex");
        #ifdef WITH_FUSE
                if (pthread_mutex_init(&inode->i_mutex, NULL) != 0) {
                        ERROR_WITH_ERRNO("Error initializing mutex");
@@ -843,9 +844,10 @@ free_inode(struct wim_inode *inode)
                wimlib_assert(inode->i_num_opened_fds == 0);
                FREE(inode->i_fds);
                pthread_mutex_destroy(&inode->i_mutex);
                wimlib_assert(inode->i_num_opened_fds == 0);
                FREE(inode->i_fds);
                pthread_mutex_destroy(&inode->i_mutex);
-               if (inode->i_hlist.pprev)
-                       hlist_del(&inode->i_hlist);
        #endif
        #endif
+               /* HACK: This may instead delete the inode from i_list, but the
+                * hlist_del() behaves the same as list_del(). */
+               hlist_del(&inode->i_hlist);
                FREE(inode->i_extracted_file);
                FREE(inode);
        }
                FREE(inode->i_extracted_file);
                FREE(inode);
        }
index f6752ff4603ef37d8d07f388d383f0b6dd22cffd..388d125a6e099a8438f751ab5a1399ccd2b36a45 100644 (file)
@@ -305,8 +305,6 @@ fix_true_inode(struct wim_inode *inode, struct list_head *inode_list)
                                return WIMLIB_ERR_INVALID_DENTRY;
                        }
                        /* Free the unneeded `struct wim_inode'. */
                                return WIMLIB_ERR_INVALID_DENTRY;
                        }
                        /* Free the unneeded `struct wim_inode'. */
-                       dentry->d_inode->i_hlist.next = NULL;
-                       dentry->d_inode->i_hlist.pprev = NULL;
                        free_inode(dentry->d_inode);
                        dentry->d_inode = ref_inode;
                        ref_inode->i_nlink++;
                        free_inode(dentry->d_inode);
                        dentry->d_inode = ref_inode;
                        ref_inode->i_nlink++;
@@ -465,6 +463,7 @@ fix_inodes(struct wim_inode_table *table, struct list_head *inode_list,
        INIT_LIST_HEAD(inode_list);
        for (u64 i = 0; i < table->capacity; i++) {
                hlist_for_each_entry_safe(inode, cur, tmp, &table->array[i], i_hlist) {
        INIT_LIST_HEAD(inode_list);
        for (u64 i = 0; i < table->capacity; i++) {
                hlist_for_each_entry_safe(inode, cur, tmp, &table->array[i], i_hlist) {
+                       INIT_LIST_HEAD(&inode->i_list);
                        ret = fix_nominal_inode(inode, inode_list, ino_changes_needed);
                        if (ret)
                                return ret;
                        ret = fix_nominal_inode(inode, inode_list, ino_changes_needed);
                        if (ret)
                                return ret;
index 84890c7e7f05b26f12e8bbeee304d7d7cb4167ed..a245a7e16a455e0575d8caffab6ae002d20f3503 100644 (file)
@@ -432,7 +432,8 @@ unix_get_ino_and_dev(const char *path, u64 *ino_ret, u64 *dev_ret)
 {
        struct stat stbuf;
        if (stat(path, &stbuf)) {
 {
        struct stat stbuf;
        if (stat(path, &stbuf)) {
-               WARNING_WITH_ERRNO("Failed to stat \"%s\"", path);
+               if (errno != ENOENT)
+                       WARNING_WITH_ERRNO("Failed to stat \"%s\"", path);
                /* Treat as a link pointing outside the capture root (it
                 * most likely is). */
                return WIMLIB_ERR_STAT;
                /* Treat as a link pointing outside the capture root (it
                 * most likely is). */
                return WIMLIB_ERR_STAT;
@@ -459,7 +460,8 @@ unix_get_ino_and_dev(const char *path, u64 *ino_ret, u64 *dev_ret)
 /* Fix up absolute symbolic link targets--- mostly shared between UNIX and
  * Windows */
 tchar *
 /* Fix up absolute symbolic link targets--- mostly shared between UNIX and
  * Windows */
 tchar *
-fixup_symlink(tchar *dest, u64 capture_root_ino, u64 capture_root_dev)
+capture_fixup_absolute_symlink(tchar *dest,
+                              u64 capture_root_ino, u64 capture_root_dev)
 {
        tchar *p = dest;
 
 {
        tchar *p = dest;
 
index 4650f4d6c1c093e851388c3097128da858f6e7dc..d0b2f89cd2fc8035a38a39afba7b1f6736d70130 100644 (file)
@@ -665,7 +665,8 @@ wim_inode_set_symlink(struct wim_inode *inode, const char *target,
                      struct wim_lookup_table *lookup_table);
 #endif
 extern tchar *
                      struct wim_lookup_table *lookup_table);
 #endif
 extern tchar *
-fixup_symlink(tchar *dest, u64 capture_root_ino, u64 capture_root_dev);
+capture_fixup_absolute_symlink(tchar *dest,
+                              u64 capture_root_ino, u64 capture_root_dev);
 
 
 /* resource.c */
 
 
 /* resource.c */
index cbc72a6bfc4918f643d94f30d5966ec5cf8196d3..eb198525ee08332277518040522d20638be34c88 100644 (file)
@@ -599,9 +599,11 @@ win32_get_file_and_vol_ids(const wchar_t *path, u64 *ino_ret, u64 *dev_ret)
        hFile = win32_open_existing_file(path, FILE_READ_ATTRIBUTES);
        if (hFile == INVALID_HANDLE_VALUE) {
                err = GetLastError();
        hFile = win32_open_existing_file(path, FILE_READ_ATTRIBUTES);
        if (hFile == INVALID_HANDLE_VALUE) {
                err = GetLastError();
-               WARNING("Failed to open \"%ls\" to get file and volume IDs",
-                       path);
-               win32_error(err);
+               if (err != ERROR_FILE_NOT_FOUND) {
+                       WARNING("Failed to open \"%ls\" to get file "
+                               "and volume IDs", path);
+                       win32_error(err);
+               }
                return WIMLIB_ERR_OPEN;
        }
 
                return WIMLIB_ERR_OPEN;
        }
 
@@ -678,8 +680,8 @@ win32_capture_maybe_rpfix_target(wchar_t *target, u16 *target_nbytes_p,
        stripped_chars = ret;
        target[target_nchars] = L'\0';
        orig_target = target;
        stripped_chars = ret;
        target[target_nchars] = L'\0';
        orig_target = target;
-       target = fixup_symlink(target + stripped_chars,
-                              capture_root_ino, capture_root_dev);
+       target = capture_fixup_absolute_symlink(target + stripped_chars,
+                                               capture_root_ino, capture_root_dev);
        if (!target)
                return RP_EXCLUDED;
        target_nchars = wcslen(target);
        if (!target)
                return RP_EXCLUDED;
        target_nchars = wcslen(target);