diff options
author | Brian Havard <bjh@apache.org> | 2010-03-16 15:37:11 +0000 |
---|---|---|
committer | Brian Havard <bjh@apache.org> | 2010-03-16 15:37:11 +0000 |
commit | e95718b059408cd4e757f864af2547a1b937e665 (patch) | |
tree | 9ff517203bebc2511b4b4e0a49fff53b579a9be1 /file_io/os2 | |
parent | 81951d3d16b3cc09b0bd550d2e8112a1431a4392 (diff) | |
download | apr-e95718b059408cd4e757f864af2547a1b937e665.tar.gz |
OS/2: In apr_dir_open(), check that the supplied directory name is actually
valid before returning APR_SUCCESS. This fixes a failure in testdir.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@923810 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/os2')
-rw-r--r-- | file_io/os2/dir.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/file_io/os2/dir.c b/file_io/os2/dir.c index 3b08355f5..f1554b6f3 100644 --- a/file_io/os2/dir.c +++ b/file_io/os2/dir.c @@ -31,6 +31,8 @@ static apr_status_t dir_cleanup(void *thedir) APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, apr_pool_t *pool) { + FILESTATUS3 filestatus; + int rv; apr_dir_t *thedir = (apr_dir_t *)apr_palloc(pool, sizeof(apr_dir_t)); if (thedir == NULL) @@ -46,6 +48,17 @@ APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, apr thedir->validentry = FALSE; *new = thedir; apr_pool_cleanup_register(pool, thedir, dir_cleanup, apr_pool_cleanup_null); + + rv = DosQueryPathInfo(dirname, FIL_STANDARD, &filestatus, sizeof(filestatus)); + + if (rv != 0) { + return APR_FROM_OS_ERROR(rv); + } + + if ((filestatus.attrFile & FILE_DIRECTORY) == 0) { + return APR_ENOTDIR; + } + return APR_SUCCESS; } |