diff options
author | Kris Kennaway <kris@FreeBSD.org> | 2001-03-04 07:02:55 +0000 |
---|---|---|
committer | Kris Kennaway <kris@FreeBSD.org> | 2001-03-04 07:02:55 +0000 |
commit | da6e578ccd519ad369ecad0cefe2fd49f3068916 (patch) | |
tree | 1be42b57eed8c5e6a29be7f5a19008b55e6e56ee /bin | |
parent | 110c89b0e621e3c4d028bb4613878dcf6c92727c (diff) | |
download | src-da6e578ccd519ad369ecad0cefe2fd49f3068916.tar.gz src-da6e578ccd519ad369ecad0cefe2fd49f3068916.zip |
MFC r1.20
Special case the error reporting when errno is ENOTDIR or ENOENT.
This makes "mkdir /nonexistant/foo" complain that /nonexistant
doesn't exist rather than /nonexistant/foo which doesn't make much
sense.
Notes
Notes:
svn path=/stable/4/; revision=73425
Diffstat (limited to 'bin')
-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 6c61abff5f14..596e09f80cd3 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); |