diff options
author | Chris Dunlap <[email protected]> | 2014-04-08 15:31:11 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-04-09 13:32:22 -0700 |
commit | 7368eb621e6c94dd8fd37020568f32c120afabf9 (patch) | |
tree | 8a12d4c1cdad7282c8922936aa3ee3a78b8ef9c2 /lib/libspl | |
parent | cc9ee13e1a36511decb526bf84146e20a846b3d6 (diff) |
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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #2248
Diffstat (limited to 'lib/libspl')
-rw-r--r-- | lib/libspl/mkdirp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libspl/mkdirp.c b/lib/libspl/mkdirp.c index f98e31e2d..2f091883a 100644 --- a/lib/libspl/mkdirp.c +++ b/lib/libspl/mkdirp.c @@ -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. |