mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-25 12:02:01 +01:00
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,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);
|
||||
|
Loading…
Reference in New Issue
Block a user