- Fix usage of setmode. it can fail due to malloc, so we should print the correct error message. Obtained-from: DragonFlyBSD Index: src/bin/mkdir/mkdir.c =================================================================== --- src/bin/mkdir/mkdir.c (revision 103) +++ src/bin/mkdir/mkdir.c (revision 104) @@ -91,8 +91,13 @@ if (mode == NULL) { omode = S_IRWXU | S_IRWXG | S_IRWXO; } else { - 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 + err(1, "setmode"); + } omode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO); free(set); }