2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Do not remove sudoedit temporary files if we cannot overwrite the real file.

The warning message says the files were preserved but they actually
got removed.
This commit is contained in:
Todd C. Miller 2020-04-21 11:05:30 -06:00
parent d22800edd5
commit 0bd39701b4

View File

@ -1110,8 +1110,10 @@ sudo_edit(struct command_details *command_details)
else
#endif
errors = sudo_edit_copy_tfiles(command_details, tf, nfiles, times);
if (errors)
goto cleanup;
if (errors) {
/* Preserve the edited temporary files. */
rc = W_EXITCODE(1, 0);
}
for (i = 0; i < nfiles; i++)
free(tf[i].tfile);