Clean up temporary sudoedit files on success; Bug #929
This is a regression introduced in sudo 1.9.0.
This commit is contained in:
@@ -698,7 +698,10 @@ sudo_edit_copy_tfiles(struct command_details *command_details,
|
|||||||
|
|
||||||
/* Overwrite the old file with the new contents. */
|
/* Overwrite the old file with the new contents. */
|
||||||
if (sudo_copy_file(tf[i].tfile, tfd, sb.st_size, tf[i].ofile, ofd,
|
if (sudo_copy_file(tf[i].tfile, tfd, sb.st_size, tf[i].ofile, ofd,
|
||||||
tf[i].osize) == -1) {
|
tf[i].osize) == 0) {
|
||||||
|
/* success, remove temporary file. */
|
||||||
|
unlink(tf[i].tfile);
|
||||||
|
} else {
|
||||||
bad:
|
bad:
|
||||||
sudo_warnx(U_("contents of edit session left in %s"), tf[i].tfile);
|
sudo_warnx(U_("contents of edit session left in %s"), tf[i].tfile);
|
||||||
errors++;
|
errors++;
|
||||||
|
Reference in New Issue
Block a user