X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fadd_image.c;h=28ece7424720a3922887504590d4506d37b6b7dd;hb=48e894ec2380866098c7dc064f3d2eedb55e6fb8;hp=0ae57361af3f5822137af62e4eca2d978e1a86b9;hpb=655c1ad6412165c62a9489a44161b62b93489838;p=wimlib diff --git a/src/add_image.c b/src/add_image.c index 0ae57361..28ece742 100644 --- a/src/add_image.c +++ b/src/add_image.c @@ -675,11 +675,15 @@ static int build_dentry_tree(struct wim_dentry **root_ret, inode->i_last_write_time = unix_timestamp_to_wim(root_stbuf.st_mtime); inode->i_last_access_time = unix_timestamp_to_wim(root_stbuf.st_atime); #endif - if (sizeof(ino_t) >= 8) - inode->i_ino = (u64)root_stbuf.st_ino; - else - inode->i_ino = (u64)root_stbuf.st_ino | - ((u64)root_stbuf.st_dev << ((sizeof(ino_t) * 8) & 63)); + /* Leave the inode number at 0 for directories. */ + if (!S_ISDIR(root_stbuf.st_mode)) { + if (sizeof(ino_t) >= 8) + inode->i_ino = (u64)root_stbuf.st_ino; + else + inode->i_ino = (u64)root_stbuf.st_ino | + ((u64)root_stbuf.st_dev << + ((sizeof(ino_t) * 8) & 63)); + } inode->i_resolved = 1; if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA) { ret = inode_set_unix_data(inode, root_stbuf.st_uid, @@ -848,7 +852,7 @@ static int build_dentry_tree(struct wim_dentry **root_ret, ret = utf8_to_utf16(root_disk_path, strlen(root_disk_path), (char**)&path_utf16, &path_utf16_nchars); if (ret) - goto out; + goto out_destroy_sd_set; path_utf16_nchars /= sizeof(wchar_t); HANDLE hFile = win32_open_file_readonly(path_utf16); @@ -857,7 +861,7 @@ static int build_dentry_tree(struct wim_dentry **root_ret, ERROR("Win32 API: Failed to open \"%s\"", root_disk_path); win32_error(err); ret = WIMLIB_ERR_OPEN; - goto out_destroy_sd_set; + goto out_free_path_utf16; } BY_HANDLE_FILE_INFORMATION file_info; @@ -1361,6 +1365,7 @@ static int do_overlay(struct wim_dentry *target, struct wim_dentry *branch) return WIMLIB_ERR_INVALID_OVERLAY; } } + free_dentry(branch); return 0; } @@ -1628,7 +1633,7 @@ WIMLIBAPI int wimlib_add_image_multisource(WIMStruct *w, if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_BOOT) wimlib_set_boot_idx(w, w->hdr.image_count); ret = 0; - goto out; + goto out_destroy_capture_config; out_destroy_imd: destroy_image_metadata(&w->image_metadata[w->hdr.image_count - 1], w->lookup_table);