From 6acae1b3bed9573d101f1be72af8f3d84aa9d7bc Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 17 Aug 2004 19:11:47 +0000 Subject: [PATCH] Better warning message when sudoedit is unable to write to the destination file. --- sudo_edit.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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); } -- 2.40.0