]> granicus.if.org Git - sudo/commitdiff
Better warning message when sudoedit is unable to write to the
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 17 Aug 2004 19:11:47 +0000 (19:11 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 17 Aug 2004 19:11:47 +0000 (19:11 +0000)
destination file.

sudo_edit.c

index d48f77b75b4500c6700e9d99eed3f57f02c912aa..c0508e04719d27a71109eec2c6403eb4557b39f1 100644 (file)
@@ -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);
     }