Set errno for mkdirp() called with NULL path ptr
If mkdirp() is called with a NULL ptr for the path arg, it will return -1 with errno unchanged. This is unexpected since on error it should return -1 and set errno to one of the error values listed for mkdir(2). This commit sets errno = ENOENT for this NULL ptr case. This is in accordance with the errors specified by mkdir(2): ENOENT A component of the path prefix does not exist or is a null pathname. Signed-off-by: Chris Dunlap <cdunlap@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #2248
This commit is contained in:
parent
cc9ee13e1a
commit
7368eb621e
|
@ -146,8 +146,10 @@ simplify(const char *str)
|
|||
* bail out if there is nothing there.
|
||||
*/
|
||||
|
||||
if (!str)
|
||||
if (!str) {
|
||||
errno = ENOENT;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a copy of the argument.
|
||||
|
|
Loading…
Reference in New Issue