Author: jonpryor
Date: 2007-09-08 15:07:17 -0400 (Sat, 08 Sep 2007)
New Revision: 85524

Modified:
   trunk/mono/support/ChangeLog
   trunk/mono/support/dirent.c
Log:
        * dirent.c: NAME_MAX isn't defined on Solaris; fix the build.


Modified: trunk/mono/support/ChangeLog
===================================================================
--- trunk/mono/support/ChangeLog        2007-09-08 15:49:57 UTC (rev 85523)
+++ trunk/mono/support/ChangeLog        2007-09-08 19:07:17 UTC (rev 85524)
@@ -1,3 +1,7 @@
+2007-09-08  Jonathan Pryor  <[EMAIL PROTECTED]>
+
+       * dirent.c: NAME_MAX isn't defined on Solaris; fix the build.
+
 2007-09-04  Jonathan Pryor  <[EMAIL PROTECTED]>
 
        * dirent.c: Fix `struct dirent' overflow on Solaris.  See #82678.

Modified: trunk/mono/support/dirent.c
===================================================================
--- trunk/mono/support/dirent.c 2007-09-08 15:49:57 UTC (rev 85523)
+++ trunk/mono/support/dirent.c 2007-09-08 19:07:17 UTC (rev 85524)
@@ -17,6 +17,16 @@
 #include "map.h"
 #include "mph.h"
 
+#if defined (PATH_MAX) && defined (NAME_MAX)
+       #define MPH_PATH_MAX MAX(PATH_MAX, NAME_MAX)
+#elif defined (PATH_MAX)
+       #define MPH_PATH_MAX PATH_MAX
+#elif defined (NAME_MAX)
+       #define MPH_PATH_MAX NAME_MAX
+#else /* !defined PATH_MAX && !defined NAME_MAX */
+       #define MPH_PATH_MAX 2048
+#endif
+
 G_BEGIN_DECLS
 
 gint32
@@ -78,8 +88,7 @@
 gint32
 Mono_Posix_Syscall_readdir_r (void *dirp, struct Mono_Posix_Syscall__Dirent 
*entry, void **result)
 {
-       struct dirent *_entry = malloc(sizeof(struct dirent) + 
-                       MAX(PATH_MAX, NAME_MAX) + 1);
+       struct dirent *_entry = malloc (sizeof (struct dirent) + MPH_PATH_MAX + 
1);
        int r;
 
        r = readdir_r (dirp, _entry, (struct dirent**) result);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to