apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject svn commit: r923810 - /apr/apr/trunk/file_io/os2/dir.c
Date Tue, 16 Mar 2010 15:37:11 GMT
Author: bjh
Date: Tue Mar 16 15:37:11 2010
New Revision: 923810

URL: http://svn.apache.org/viewvc?rev=923810&view=rev
Log:
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.

Modified:
    apr/apr/trunk/file_io/os2/dir.c

Modified: apr/apr/trunk/file_io/os2/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/os2/dir.c?rev=923810&r1=923809&r2=923810&view=diff
==============================================================================
--- apr/apr/trunk/file_io/os2/dir.c (original)
+++ apr/apr/trunk/file_io/os2/dir.c Tue Mar 16 15:37:11 2010
@@ -31,6 +31,8 @@ static apr_status_t dir_cleanup(void *th
 
 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(a
     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;
 }
 



Mime
View raw message