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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user