Clean up temporary sudoedit files on success; Bug #929

This is a regression introduced in sudo 1.9.0.
This commit is contained in:
Todd C. Miller
2020-06-14 16:40:21 -06:00
parent ddd3b0eced
commit bee9950593

View File

@@ -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++;