commit 376940d376b81cdd7ab41a36c72ad937c4678cb1
parent 98872e10dbac98b6ff2b7c0e423ba6e825913b99
Author: hhvn <dev@hhvn.uk>
Date: Sun, 6 Jun 2021 18:23:23 +0100
finger.c: use pledge
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/finger.c b/finger.c
@@ -17,6 +17,10 @@
#define HOST_DFLT "localhost"
#define PORT_DFLT "79"
+#ifndef __OpenBSD__
+#define pledge(a,b) 0
+#endif
+
enum { ISUSER, ISHOST, ISPORT };
char *argv0;
@@ -106,6 +110,9 @@ main(int argc, char *argv[]) {
usage();
} ARGEND;
+ if (pledge("stdio inet dns", NULL) == -1)
+ die(1, "pledge: %s\n", strerror(errno));
+
if (argc < 1)
die(1, "no targets specified\n");