diff options
Diffstat (limited to 'bin/mkdir/mkdir.c')
-rw-r--r-- | bin/mkdir/mkdir.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/mkdir/mkdir.c b/bin/mkdir/mkdir.c index 6c61abf..596e09f 100644 --- a/bin/mkdir/mkdir.c +++ b/bin/mkdir/mkdir.c @@ -50,6 +50,7 @@ static const char rcsid[] = #include <err.h> #include <errno.h> +#include <libgen.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -108,7 +109,10 @@ main(argc, argv) if (build(*argv, omode)) success = 0; } else if (mkdir(*argv, omode) < 0) { - warn("%s", *argv); + if (errno == ENOTDIR || errno == ENOENT) + warn("%s", dirname(*argv)); + else + warn("%s", *argv); success = 0; } else if (vflag) (void)printf("%s\n", *argv); |