apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r279732 - /apr/apr/branches/1.2.x/file_io/unix/dir.c
Date Fri, 09 Sep 2005 08:42:24 GMT
Author: jorton
Date: Fri Sep  9 01:42:21 2005
New Revision: 279732

URL: http://svn.apache.org/viewcvs?rev=279732&view=rev
Log:
Merge r265684 from trunk:

* file_io/unix/dir.c (apr_dir_open): Fix error handling; don't assume
that apr_pcalloc can't change errno.  Remove a redundant cast to 
void *.


Modified:
    apr/apr/branches/1.2.x/file_io/unix/dir.c

Modified: apr/apr/branches/1.2.x/file_io/unix/dir.c
URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/file_io/unix/dir.c?rev=279732&r1=279731&r2=279732&view=diff
==============================================================================
--- apr/apr/branches/1.2.x/file_io/unix/dir.c (original)
+++ apr/apr/branches/1.2.x/file_io/unix/dir.c Fri Sep  9 01:42:21 2005
@@ -79,22 +79,22 @@
     apr_size_t dirent_size = 
         (sizeof((*new)->entry->d_name) > 1 ? 
          sizeof(struct dirent) : sizeof (struct dirent) + 255);
+    DIR *dir = opendir(dirname);
+
+    if (!dir) {
+        return errno;
+    }
 
     (*new) = (apr_dir_t *)apr_palloc(pool, sizeof(apr_dir_t));
 
     (*new)->pool = pool;
     (*new)->dirname = apr_pstrdup(pool, dirname);
-    (*new)->dirstruct = opendir(dirname);
+    (*new)->dirstruct = dir;
     (*new)->entry = apr_pcalloc(pool, dirent_size);
 
-    if ((*new)->dirstruct == NULL) {
-        return errno;
-    }    
-    else {
-        apr_pool_cleanup_register((*new)->pool, (void *)(*new), dir_cleanup,
-	                          apr_pool_cleanup_null);
-        return APR_SUCCESS;
-    }
+    apr_pool_cleanup_register((*new)->pool, *new, dir_cleanup,
+                              apr_pool_cleanup_null);
+    return APR_SUCCESS;
 }
 
 apr_status_t apr_dir_close(apr_dir_t *thedir)



Mime
View raw message