X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fntfs-3g_capture.c;h=0417b0b8c5249b3bca3ef09e0d11e7b8850f125d;hb=55a72fc546978ea0502ef0d0eba73ffd6c3ee785;hp=af6fa5423de2208b98d3b927683ea336dfde119a;hpb=3071e89c11d1be71cf45b694432e5908e0c4ded9;p=wimlib diff --git a/src/ntfs-3g_capture.c b/src/ntfs-3g_capture.c index af6fa542..0417b0b8 100644 --- a/src/ntfs-3g_capture.c +++ b/src/ntfs-3g_capture.c @@ -29,17 +29,14 @@ #ifdef WITH_NTFS_3G #include -#include - -#ifdef HAVE_ALLOCA_H -# include -#endif #include #include #include #include +#include "wimlib/alloca.h" +#include "wimlib/assert.h" #include "wimlib/capture.h" #include "wimlib/dentry.h" #include "wimlib/encoding.h" @@ -392,7 +389,7 @@ set_dentry_dos_name(struct wim_dentry *dentry, const struct dos_name_map *map) if (dentry->is_win32_name) { node = lookup_dos_name(map, dentry->d_inode->i_ino); if (node) { - dentry->short_name = utf16le_dupz((const utf16lechar *)node->dos_name, + dentry->short_name = utf16le_dupz(node->dos_name, node->name_nbytes); if (!dentry->short_name) return WIMLIB_ERR_NOMEM; @@ -429,7 +426,7 @@ struct readdir_ctx { size_t path_len; struct dos_name_map *dos_name_map; ntfs_volume *vol; - struct add_image_params *params; + struct capture_params *params; int ret; }; @@ -440,7 +437,7 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_p, size_t path_len, int name_type, ntfs_volume *ntfs_vol, - struct add_image_params *params); + struct capture_params *params); static int wim_ntfs_capture_filldir(void *dirent, const ntfschar *name, @@ -527,7 +524,7 @@ build_dentry_tree_ntfs_recursive(struct wim_dentry **root_ret, size_t path_len, int name_type, ntfs_volume *vol, - struct add_image_params *params) + struct capture_params *params) { u32 attributes; int ret; @@ -704,10 +701,12 @@ out_progress: else ret = do_capture_progress(params, WIMLIB_SCAN_DENTRY_OK, inode); out: - if (ret == 0) - *root_ret = root; - else + if (unlikely(ret)) { free_dentry_tree(root, params->lookup_table); + root = NULL; + ret = report_capture_error(params, ret, path); + } + *root_ret = root; return ret; } @@ -725,7 +724,7 @@ do_ntfs_umount(struct _ntfs_volume *vol) int build_dentry_tree_ntfs(struct wim_dentry **root_p, const char *device, - struct add_image_params *params) + struct capture_params *params) { ntfs_volume *vol; ntfs_inode *root_ni;