* 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,
};
#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"
#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 */
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;
}
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;
}
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;
}