Sorry, my terminal seems to be mangling tabs into spaces. Here's a
properly copypasted diff:
Index: bin/chmod/chmod.c
===================================================================
RCS file: /cvs/src/bin/chmod/chmod.c,v
retrieving revision 1.34
diff -u -p -r1.34 chmod.c
--- bin/chmod/chmod.c 25 Jun 2015 02:04:08 -0000 1.34
+++ bin/chmod/chmod.c 29 Aug 2015 11:33:33 -0000
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/tame.h>
#include <err.h>
#include <errno.h>
@@ -153,6 +154,8 @@ done:
atflags = 0;
if (ischflags) {
+ tame(TAME_STDIO | TAME_RPATH | TAME_FATTR, NULL);
+
flags = *argv;
if (*flags >= '0' && *flags <= '7') {
errno = 0;
Index: usr.bin/head/head.c
===================================================================
RCS file: /cvs/src/usr.bin/head/head.c,v
retrieving revision 1.18
diff -u -p -r1.18 head.c
--- usr.bin/head/head.c 8 Oct 2014 08:31:53 -0000 1.18
+++ usr.bin/head/head.c 29 Aug 2015 11:33:33 -0000
@@ -29,6 +29,8 @@
* SUCH DAMAGE.
*/
+#include <sys/tame.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -87,6 +89,7 @@ main(int argc, char *argv[])
if (!firsttime)
exit(status);
fp = stdin;
+ tame(TAME_STDIO, NULL);
} else {
if ((fp = fopen(*argv, "r")) == NULL) {
warn("%s", *argv++);