You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2019/03/25 13:59:28 UTC

svn commit: r1856192 - /apr/apr/trunk/file_io/unix/dir.c

Author: ylavic
Date: Mon Mar 25 13:59:28 2019
New Revision: 1856192

URL: http://svn.apache.org/viewvc?rev=1856192&view=rev
Log:
Follow up to r1856189: use NAME_MAX from limits.h when available.

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

Modified: apr/apr/trunk/file_io/unix/dir.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/unix/dir.c?rev=1856192&r1=1856191&r2=1856192&view=diff
==============================================================================
--- apr/apr/trunk/file_io/unix/dir.c (original)
+++ apr/apr/trunk/file_io/unix/dir.c Mon Mar 25 13:59:28 2019
@@ -24,6 +24,10 @@
 #include <limits.h>
 #endif
 
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+
 static apr_status_t dir_cleanup(void *thedir)
 {
     apr_dir_t *dir = thedir;
@@ -78,7 +82,7 @@ apr_status_t apr_dir_open(apr_dir_t **ne
      */
     apr_size_t dirent_size = 
         sizeof(*(*new)->entry) +
-        (sizeof((*new)->entry->d_name) > 1 ? 0 : 255);
+        (sizeof((*new)->entry->d_name) > 1 ? 0 : NAME_MAX);
     DIR *dir = opendir(dirname);
 
     if (!dir) {