X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fupdate_image.c;h=f4affbddcd309ab986897d449da017fcdf9ba785;hp=2247a7f6840307751936b69f6ad618c30ecabf2a;hb=HEAD;hpb=38bd45bb7e08f2072e256afd5bcc21ceb0d97b8e diff --git a/src/update_image.c b/src/update_image.c index 2247a7f6..c4a2d571 100644 --- a/src/update_image.c +++ b/src/update_image.c @@ -16,7 +16,7 @@ * details. * * You should have received a copy of the GNU Lesser General Public License - * along with this file; if not, see http://www.gnu.org/licenses/. + * along with this file; if not, see https://www.gnu.org/licenses/. */ /* @@ -742,9 +742,12 @@ get_capture_config(const tchar *config_file, struct capture_config *config, size_t len = tstrlen(fs_source_path) + tstrlen(wimboot_cfgfile); - tmp_config_file = MALLOC((len + 1) * sizeof(tchar)); struct stat st; + tmp_config_file = MALLOC((len + 1) * sizeof(tchar)); + if (!tmp_config_file) + return WIMLIB_ERR_NOMEM; + tsprintf(tmp_config_file, T("%"TS"%"TS), fs_source_path, wimboot_cfgfile); if (!tstat(tmp_config_file, &st)) { @@ -955,7 +958,7 @@ is_ancestor(const struct wim_dentry *d1, const struct wim_dentry *d2) */ int rename_wim_path(WIMStruct *wim, const tchar *from, const tchar *to, - CASE_SENSITIVITY_TYPE case_type, + CASE_SENSITIVITY_TYPE case_type, bool noreplace, struct update_command_journal *j) { struct wim_dentry *src; @@ -975,6 +978,9 @@ rename_wim_path(WIMStruct *wim, const tchar *from, const tchar *to, if (dst) { /* Destination file exists */ + if (noreplace) + return -EEXIST; + if (src == dst) /* Same file */ return 0; @@ -1042,7 +1048,7 @@ execute_rename_command(struct update_command_journal *j, ret = rename_wim_path(wim, rename_cmd->rename.wim_source_path, rename_cmd->rename.wim_target_path, - WIMLIB_CASE_PLATFORM_DEFAULT, j); + WIMLIB_CASE_PLATFORM_DEFAULT, false, j); if (ret) { ret = -ret; errno = ret; @@ -1231,7 +1237,7 @@ check_add_command(struct wimlib_update_command *cmd, } #endif -#ifdef __WIN32__ +#ifdef _WIN32 /* Check for flags not supported on Windows. */ if (add_flags & WIMLIB_ADD_FLAG_UNIX_DATA) { ERROR("Capturing UNIX-specific data is not supported on Windows");