- Fix usage of setmode. it can fail due to malloc, so we should print the correct error message. - Add WARNS?= 6 Submitted by: Liam J. Foy Index: src/bin/chmod/chmod.c =================================================================== --- src/bin/chmod/chmod.c (revision 91) +++ src/bin/chmod/chmod.c (revision 92) @@ -145,8 +145,14 @@ change_mode = chmod; mode = *argv; - if ((set = setmode(mode)) == NULL) - errx(1, "invalid file mode: %s", mode); + errno = 0; + if ((set = setmode(mode)) == NULL) { + if (!errno) + errx(1, "invalid file mode: %s", mode); + else + /* malloc for setmode failed */ + err(1, "setmode"); + } if ((ftsp = fts_open(++argv, fts_options, 0)) == NULL) err(1, "fts_open"); Index: src/bin/chmod/Makefile =================================================================== --- src/bin/chmod/Makefile (revision 91) +++ src/bin/chmod/Makefile (revision 92) @@ -2,5 +2,6 @@ # $FreeBSD: src/bin/chmod/Makefile,v 1.10 2002/07/15 12:08:21 sheldonh Exp $ PROG= chmod +WARNS?= 6 .include