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. Submitted (in a different form) by: W.H.Scholten <whs@xs4all.nl>
This commit is contained in:
parent
8b075ef933
commit
c51117f58d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=71029
@ -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,6 +109,9 @@ main(argc, argv)
|
||||
if (build(*argv, omode))
|
||||
success = 0;
|
||||
} else if (mkdir(*argv, omode) < 0) {
|
||||
if (errno == ENOTDIR || errno == ENOENT)
|
||||
warn("%s", dirname(*argv));
|
||||
else
|
||||
warn("%s", *argv);
|
||||
success = 0;
|
||||
} else if (vflag)
|
||||
|
Loading…
Reference in New Issue
Block a user