Hi, This one was my fault, mesg(1) should only return 1 when we disallow messages. When we want to exit if an error has occurred it must be >1 instead. Additionally the err(3) for the pledge case must be changed.
OK? Index: mesg.c =================================================================== RCS file: /cvs/src/usr.bin/mesg/mesg.c,v retrieving revision 1.13 diff -u -p -u -r1.13 mesg.c --- mesg.c 3 Aug 2018 06:57:34 -0000 1.13 +++ mesg.c 10 Aug 2018 09:55:34 -0000 @@ -65,9 +65,9 @@ main(int argc, char *argv[]) err(2, "ttyname"); if (unveil(tty, "rw") == -1) - err(1, "unveil"); + err(2, "unveil"); if (pledge("stdio rpath fattr", NULL) == -1) - err(1, "unveil"); + err(2, "pledge"); if (stat(tty, &sb) < 0) err(2, "%s", tty);