From: Eric Biggers Date: Sun, 28 Apr 2013 02:37:20 +0000 (-0500) Subject: Misc. fixes X-Git-Tag: v1.3.3~17 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=1153f04c39e01b96f983132f1367f777f852ac99 Misc. fixes --- diff --git a/src/add_image.c b/src/add_image.c index d9e4ca29..9bd597a1 100644 --- a/src/add_image.c +++ b/src/add_image.c @@ -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" diff --git a/src/dentry.c b/src/dentry.c index 7cd93ed1..8f0ed206 100644 --- a/src/dentry.c +++ b/src/dentry.c @@ -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); } diff --git a/src/hardlink.c b/src/hardlink.c index f6752ff4..388d125a 100644 --- a/src/hardlink.c +++ b/src/hardlink.c @@ -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; diff --git a/src/reparse.c b/src/reparse.c index 84890c7e..a245a7e1 100644 --- a/src/reparse.c +++ b/src/reparse.c @@ -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; diff --git a/src/wimlib_internal.h b/src/wimlib_internal.h index 4650f4d6..d0b2f89c 100644 --- a/src/wimlib_internal.h +++ b/src/wimlib_internal.h @@ -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 */ diff --git a/src/win32.c b/src/win32.c index cbc72a6b..eb198525 100644 --- a/src/win32.c +++ b/src/win32.c @@ -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);