1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
$NetBSD: patch-ah,v 1.3 2014/07/07 18:06:58 jperkin Exp $
Support SunOS.
--- fileio.c.orig 2011-09-05 18:26:37.000000000 +0000
+++ fileio.c
@@ -14,6 +14,10 @@
#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
#endif
+#ifndef NAME_MAX
+#define NAME_MAX MAXNAMLEN
+#endif
+
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
@@ -544,11 +548,7 @@ make_file_list(char *buf)
* SV files are fairly short. For BSD, something more general would
* be required.
*/
-#ifdef __CYGWIN__ /* Cygwin uses NAME_MAX for dirents */
if (preflen > NFILEN - NAME_MAX)
-#else
- if (preflen > NFILEN - MAXNAMLEN)
-#endif
return (NULL);
/* loop over the specified directory, making up the list of files */
@@ -570,7 +570,7 @@ make_file_list(char *buf)
#if defined (__CYGWIN__) /* Cygwin lacks reclen/namlen. */
if (strlen(dent->d_name) < len
|| memcmp(cp, dent->d_name, len) != 0)
-#elif defined (__GLIBC__) /* Linux uses reclen instead. */
+#elif defined (__GLIBC__) || defined(__sun) /* Linux uses reclen instead. */
if (dent->d_reclen < len || memcmp(cp, dent->d_name, len) != 0)
#else
if (dent->d_namlen < len || memcmp(cp, dent->d_name, len) != 0)
@@ -579,7 +579,7 @@ make_file_list(char *buf)
isdir = 0;
-#ifndef __CYGWIN__ /* No support for d_type in Cygwin, do all
+#if !defined(__CYGWIN__) && !defined(__sun) /* No support for d_type in Cygwin, do all
type cheking with stat. */
if (dent->d_type == DT_DIR) {
isdir = 1;
|