apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r278711 - /apr/apr/trunk/file_io/unix/dir.c
Date Mon, 05 Sep 2005 10:45:37 GMT
Author: jorton
Date: Mon Sep  5 03:45:30 2005
New Revision: 278711

URL: http://svn.apache.org/viewcvs?rev=278711&view=rev
Log:
* file_io/unix/dir.c (apr_dir_read): Clarify handling of
end-of-directory; the "Linux problem" being the behaviour required by
POSIX.

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

Modified: apr/apr/trunk/file_io/unix/dir.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/file_io/unix/dir.c?rev=278711&r1=278710&r2=278711&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/dir.c (original)
+++ apr/apr/trunk/file_io/unix/dir.c Mon Sep  5 03:45:30 2005
@@ -162,11 +162,11 @@
     ret = readdir_r(thedir->dirstruct, thedir->entry, &retent);
 #endif
 
-    /* Avoid the Linux problem where at end-of-directory thedir->entry
-     * is set to NULL, but ret = APR_SUCCESS.
-     */
-    if(!ret && thedir->entry != retent)
+    /* POSIX treats "end of directory" as a non-error case, so ret
+     * will be zero and retent will be set to NULL in that case. */
+    if (!ret && retent == NULL) {
         ret = APR_ENOENT;
+    }
 
     /* Solaris is a bit strange, if there are no more entries in the
      * directory, it returns EINVAL.  Since this is against POSIX, we



Mime
View raw message