- if (add_cmds) {
- for (size_t i = 0; i < num_sources; i++) {
- DEBUG("Source %zu of %zu: fs_source_path=\"%"TS"\", "
- "wim_target_path=\"%"TS"\"",
- i + 1, num_sources,
- sources[i].fs_source_path,
- sources[i].wim_target_path);
- add_cmds[i].op = WIMLIB_UPDATE_OP_ADD;
- add_cmds[i].add.add_flags = add_flags & ~WIMLIB_ADD_FLAG_BOOT;
- add_cmds[i].add.config_file = (tchar *)config_file;
- add_cmds[i].add.fs_source_path = sources[i].fs_source_path;
- add_cmds[i].add.wim_target_path = sources[i].wim_target_path;
- }
+ if (!add_cmds)
+ return NULL;
+
+ /* WIMLIB_ADD_FLAG_BOOT is handled by wimlib_add_image_multisource(),
+ * not wimlib_update_image(), so mask it out.
+ *
+ * However, WIMLIB_ADD_FLAG_WIMBOOT is handled by both. */
+ add_flags &= ~WIMLIB_ADD_FLAG_BOOT;
+
+ for (size_t i = 0; i < num_sources; i++) {
+ add_cmds[i].op = WIMLIB_UPDATE_OP_ADD;
+ add_cmds[i].add.fs_source_path = sources[i].fs_source_path;
+ add_cmds[i].add.wim_target_path = sources[i].wim_target_path;
+ add_cmds[i].add.add_flags = add_flags;
+ add_cmds[i].add.config_file = (tchar *)config_file;