- if (ref_flags & WIMLIB_REF_FLAG_GLOB_ENABLE) {
- for (i = 0; i < count; i++) {
- ret = reference_resource_glob(wim,
- resource_wimfiles_or_globs[i],
- ref_flags,
- open_flags);
- if (ret)
- return ret;
- }
- return 0;
- } else {
- return reference_resource_paths(wim, resource_wimfiles_or_globs,
- count, ref_flags, open_flags);
- }
+ init_reference_info(&info, wim, ref_flags);
+
+ if (ref_flags & WIMLIB_REF_FLAG_GLOB_ENABLE)
+ ret = reference_resource_globs(&info, paths_or_globs, count, open_flags);
+ else
+ ret = reference_resource_paths(&info, paths_or_globs, count, open_flags);
+
+ return commit_or_rollback_reference_info(&info, ret);