]> wimlib.net Git - wimlib/blobdiff - src/extract_image.c
capture_ntfs_streams(): Set 'ret' properly
[wimlib] / src / extract_image.c
index fc24d9bd6df04e8c34ac1e892be210a189aeb19a..fffdcfd1f239fba3f8b00e672d2cc0f3428e7fde 100644 (file)
@@ -111,7 +111,7 @@ extract_regular_file_linked(struct wim_dentry *dentry,
                const char *p2;
                size_t i;
 
-               num_path_components = get_num_path_components(output_path) - 1;
+               num_path_components = get_num_path_components(dentry->_full_path) - 1;
                num_output_dir_path_components = get_num_path_components(args->target);
 
                if (args->extract_flags & WIMLIB_EXTRACT_FLAG_MULTI_IMAGE) {
@@ -331,7 +331,7 @@ extract_symlink(struct wim_dentry *dentry,
 
        if (ret <= 0) {
                ERROR("Could not read the symbolic link from dentry `%s'",
-                     dentry_full_path(dentry));
+                     dentry->_full_path);
                return WIMLIB_ERR_INVALID_DENTRY;
        }
        ret = symlink(target, output_path);
@@ -492,7 +492,6 @@ apply_dentry_normal(struct wim_dentry *dentry, void *arg)
        struct apply_args *args = arg;
        tchar *output_path;
        size_t len;
-       int ret;
 
        len = tstrlen(args->target);
        if (dentry_is_root(dentry)) {
@@ -525,8 +524,6 @@ apply_dentry_timestamps_normal(struct wim_dentry *dentry, void *arg)
        if (dentry_is_root(dentry)) {
                output_path = (tchar*)args->target;
        } else {
-               if (!dentry_full_path(dentry))
-                       return WIMLIB_ERR_NOMEM;
                output_path = alloca(len * sizeof(tchar) + dentry->full_path_nbytes +
                                     sizeof(tchar));
                memcpy(output_path, args->target, len * sizeof(tchar));
@@ -554,10 +551,6 @@ maybe_apply_dentry(struct wim_dentry *dentry, void *arg)
        if (dentry->is_extracted)
                return 0;
 
-       ret = calculate_dentry_full_path(dentry);
-       if (ret)
-               return ret;
-
        if (args->extract_flags & WIMLIB_EXTRACT_FLAG_NO_STREAMS)
                if (inode_unnamed_lte_resolved(dentry->d_inode))
                        return 0;
@@ -853,12 +846,16 @@ extract_single_image(WIMStruct *w, int image,
                              &args.progress);
        }
 
+       ret = calculate_dentry_tree_full_paths(wim_root_dentry(w));
+       if (ret)
+               goto out;
+
        /* Make the directory structure and extract empty files */
        args.extract_flags |= WIMLIB_EXTRACT_FLAG_NO_STREAMS;
        args.apply_dentry = ops->apply_dentry;
        ret = for_dentry_in_tree(wim_root_dentry(w), maybe_apply_dentry, &args);
        args.extract_flags &= ~WIMLIB_EXTRACT_FLAG_NO_STREAMS;
-       if (ret != 0)
+       if (ret)
                goto out;
 
        if (progress_func) {
@@ -868,7 +865,7 @@ extract_single_image(WIMStruct *w, int image,
 
        /* Extract non-empty files */
        ret = apply_stream_list(&stream_list, &args, ops, progress_func);
-       if (ret != 0)
+       if (ret)
                goto out;
 
        if (progress_func) {
@@ -879,7 +876,7 @@ extract_single_image(WIMStruct *w, int image,
        /* Apply timestamps */
        ret = for_dentry_in_tree_depth(wim_root_dentry(w),
                                       ops->apply_dentry_timestamps, &args);
-       if (ret != 0)
+       if (ret)
                goto out;
 
        if (progress_func) {
@@ -901,7 +898,7 @@ out:
        return ret;
 }
 
-static const tchar *filename_forbidden_chars =
+static const tchar * const filename_forbidden_chars =
 T(
 #ifdef __WIN32__
 "<>:\"/\\|?*"