aboutsummaryrefslogtreecommitdiffstats
path: root/safepath.c
diff options
context:
space:
mode:
Diffstat (limited to 'safepath.c')
-rw-r--r--safepath.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/safepath.c b/safepath.c
index 862b5ed..7d9f6fc 100644
--- a/safepath.c
+++ b/safepath.c
@@ -132,6 +132,8 @@ static int safepath_err(int eno)
return SAFEPATH_OK;
case ENOENT:
return SAFEPATH_NOENT;
+ case ENOTDIR:
+ return SAFEPATH_NOTDIR;
case EPERM:
case EACCES:
return SAFEPATH_PERM;
@@ -158,6 +160,9 @@ static void set_errno(int spres)
case SAFEPATH_NOENT:
errno = ENOENT;
break;
+ case SAFEPATH_NOTDIR:
+ errno = ENOTDIR;
+ break;
case SAFEPATH_INVAL:
errno = EINVAL;
break;
@@ -344,6 +349,7 @@ const char *safepath_strerr(int err)
[SAFEPATH_UNSAFE] = "path contains untrusted component",
[SAFEPATH_PERM] = "path contains inaccessible component",
[SAFEPATH_NOENT] = "path contains nonexistent component",
+ [SAFEPATH_NOTDIR] = "path contains non-directory component",
[SAFEPATH_INVAL] = "path is syntactically invalid",
[SAFEPATH_NOMEM] = "out of memory",
[SAFEPATH_LOOP] = "too many symlink resolutions"