]> wimlib.net Git - wimlib/commitdiff
Report directory tree scan errors
authorEric Biggers <ebiggers3@gmail.com>
Wed, 22 Oct 2014 03:18:05 +0000 (22:18 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Wed, 22 Oct 2014 03:25:29 +0000 (22:25 -0500)
include/wimlib.h
include/wimlib/capture.h
src/ntfs-3g_capture.c
src/unix_capture.c
src/win32_capture.c

index ffc9cdbf3d9ef31acee107fe6594d387bf93412f..649f52a3c884f3734423db2fc9e073362a52707e 100644 (file)
@@ -725,6 +725,7 @@ enum wimlib_progress_msg {
         * Currently, only the following types of errors will result in this
         * progress message being sent:
         *
+        *      - Directory tree scan errors, e.g. from wimlib_add_image()
         */
        WIMLIB_PROGRESS_MSG_HANDLE_ERROR = 31,
 };
index b30688a45cac78c6e85fe81d1622e7343f636aa6..b2938d510b6a59d622d8f6f8f0f7dba6cc44c3ef 100644 (file)
@@ -4,6 +4,7 @@
 #include "wimlib.h"
 #include "wimlib/inode_table.h"
 #include "wimlib/list.h"
+#include "wimlib/progress.h"
 #include "wimlib/security.h"
 #include "wimlib/textfile.h"
 #include "wimlib/util.h"
@@ -115,4 +116,11 @@ unix_build_dentry_tree(struct wim_dentry **root_ret,
 
 #define WIMLIB_ADD_FLAG_ROOT   0x80000000
 
+static inline int
+report_capture_error(struct add_image_params *params, int error_code,
+                    const tchar *path)
+{
+       return report_error(params->progfunc, params->progctx, error_code, path);
+}
+
 #endif /* _WIMLIB_CAPTURE_H */
index af6fa5423de2208b98d3b927683ea336dfde119a..6255f09a5ac6521efd002130224ca4776b4eba6e 100644 (file)
@@ -704,10 +704,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;
 }
 
index 884c9fd4394972c4475842f1d5482d9a662b2ec9..66cb4be20265133a647f425d63b8e3f81723d91b 100644 (file)
@@ -437,10 +437,12 @@ out_progress:
        else
                ret = do_capture_progress(params, WIMLIB_SCAN_DENTRY_EXCLUDED, NULL);
 out:
-       if (likely(ret == 0))
-               *tree_ret = tree;
-       else
+       if (unlikely(ret)) {
                free_dentry_tree(tree, params->lookup_table);
+               tree = NULL;
+               ret = report_capture_error(params, ret, full_path);
+       }
+       *tree_ret = tree;
        return ret;
 }
 
index 7d6d45838178ac773bdd5a1ee0f68b3b4421f1fc..449e73e07714dd5a6d2724a8a289d40eac0fff1b 100644 (file)
@@ -1383,10 +1383,12 @@ out_progress:
 out:
        if (likely(h != INVALID_HANDLE_VALUE))
                (*func_NtClose)(h);
-       if (likely(ret == 0))
-               *root_ret = root;
-       else
+       if (unlikely(ret)) {
                free_dentry_tree(root, params->lookup_table);
+               root = NULL;
+               ret = report_capture_error(params, ret, full_path);
+       }
+       *root_ret = root;
        return ret;
 }