From: Todd C. Miller Date: Tue, 17 Aug 2004 19:11:47 +0000 (+0000) Subject: Better warning message when sudoedit is unable to write to the X-Git-Tag: SUDO_1_6_8~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6acae1b3bed9573d101f1be72af8f3d84aa9d7bc;p=sudo Better warning message when sudoedit is unable to write to the destination file. --- diff --git a/sudo_edit.c b/sudo_edit.c index d48f77b75..c0508e047 100644 --- a/sudo_edit.c +++ b/sudo_edit.c @@ -269,8 +269,8 @@ int sudo_edit(argc, argv) ofd = open(tf[i].ofile, O_WRONLY|O_TRUNC|O_CREAT, 0644); set_perms(PERM_ROOT); if (ofd == -1) { - warn("unable to save to %s, contents of edit session saved in %s", - tf[i].ofile, tf[i].tfile); + warn("unable to write to %s", tf[i].ofile); + warnx("contents of edit session left in %s", tf[i].tfile); close(tfd); continue; } @@ -285,9 +285,10 @@ int sudo_edit(argc, argv) } if (nread == 0) unlink(tf[i].tfile); - else - warn("unable to save to %s, contents of edit session saved in %s", - tf[i].ofile, tf[i].tfile); + else { + warn("unable to write to %s", tf[i].ofile); + warnx("contents of edit session left in %s", tf[i].tfile); + } close(ofd); close(tfd); }