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 d9e4ca2..9bd597a 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] == '/')
                {
-                       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"
index 7cd93ed..8f0ed20 100644 (file)
@@ -711,6 +711,7 @@ new_timeless_inode()
                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");
@@ -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);
-               if (inode->i_hlist.pprev)
-                       hlist_del(&inode->i_hlist);
        #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);
        }
index f6752ff..388d125 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'. */
-                       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++;
@@ -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->i_list);
                        ret = fix_nominal_inode(inode, inode_list, ino_changes_needed);
                        if (ret)
                                return ret;
index 84890c7..a245a7e 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)) {
-               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;
@@ -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 *
-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;
 
index 4650f4d..d0b2f89 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 *
-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 */
index cbc72a6..eb19852 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();
-               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;
        }
 
@@ -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;
-       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);