rev(1): drop "rpath" promise in no-file branch.
authorcheloha <cheloha@openbsd.org>
Tue, 8 Feb 2022 17:44:18 +0000 (17:44 +0000)
committercheloha <cheloha@openbsd.org>
Tue, 8 Feb 2022 17:44:18 +0000 (17:44 +0000)
We don't need "rpath" if we're only processing the standard input.

Thread: https://marc.info/?l=openbsd-tech&m=164433848419371&w=2

ok deraadt@ millert@

usr.bin/rev/rev.c

index 9314c2b..5938e06 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rev.c,v 1.15 2022/01/29 00:11:54 cheloha Exp $        */
+/*     $OpenBSD: rev.c,v 1.16 2022/02/08 17:44:18 cheloha Exp $        */
 /*     $NetBSD: rev.c,v 1.5 1995/09/28 08:49:40 tls Exp $      */
 
 /*-
@@ -68,6 +68,9 @@ main(int argc, char *argv[])
 
        rval = 0;
        if (argc == 0) {
+               if (pledge("stdio", NULL) == -1)
+                       err(1, "pledge");
+
                rval = rev_file(NULL);
        } else {
                for (; *argv != NULL; argv++)