Package: erlang / 1:21.2.6+dfsg-1

gnu.patch Patch series | download
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
Author: Aurelien Jarno <aurel32@debian.org>
Author: Sergei Golovan <sgolovan@debian.org>
Author: Pino Toscano <pino@debian.org>

(1) Defines GNU macros not only for Linux but also for any system
    with 'gnu' substring in OS name. Fixes FTBFS on GNU/kFreeBSD and GNU/Hurd.

(2) Undefines BSD4_4 for os_mon application for GNU/Hurd;

(3) Undefines AF_LINK for GNU/Hurd;

(4) Switch some PATH_MAX occurrences to MAXPATHLEN;

--- a/erts/configure.in
+++ b/erts/configure.in
@@ -451,7 +451,7 @@
 
 dnl NOTE: CPPFLAGS will be included in CFLAGS at the end
 case $host_os in
-    linux*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE";; 
+    linux*|*gnu*) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE";; 
     win32)
 	# The ethread library requires _WIN32_WINNT of at least 0x0403.
 	# -D_WIN32_WINNT=* from CPPFLAGS is saved in ETHR_DEFS.
@@ -1209,7 +1209,7 @@
 fi
 
 case $host_os in
-    linux*)
+    linux*|*gnu*)
 	AC_MSG_CHECKING([whether dlopen() needs to be called before first call to dlerror()])
 	if test "x$ETHR_THR_LIB_BASE_TYPE" != "xposix_nptl"; then
 	    AC_DEFINE(ERTS_NEED_DLOPEN_BEFORE_DLERROR,[1],
--- a/lib/os_mon/c_src/memsup.c
+++ b/lib/os_mon/c_src/memsup.c
@@ -99,6 +99,11 @@
 #include <time.h>
 #include <errno.h>
 
+#ifdef __GNU__
+#warning "Undefined BSD4_4 for GNU/Hurd"
+#undef BSD4_4
+#endif
+
 #ifdef BSD4_4
 #include <sys/types.h>
 #include <sys/sysctl.h>
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -4821,6 +4821,11 @@
     *x = addr;
     return 0;
 }
+#ifdef __GNU__
+#warning "Undefined AF_LINK for GNU/Hurd"
+#undef AF_LINK
+#endif
+
 
 #endif
 
--- a/erts/etc/common/erlexec.c
+++ b/erts/etc/common/erlexec.c
@@ -1604,7 +1604,7 @@
     if (!bindir) {
 	/* Determine bindir from absolute path to executable */
 	char *p;
-	char buffer[PATH_MAX];
+	char buffer[MAXPATHLEN];
 	strncpy(buffer, argv[0], sizeof(buffer));
 	buffer[sizeof(buffer)-1] = '\0';
 	
@@ -1618,7 +1618,7 @@
     if (!rootdir) {
 	/* Determine rootdir from absolute path to bindir */
 	char *p;
-	char buffer[PATH_MAX];
+	char buffer[MAXPATHLEN];
 	strncpy(buffer, bindir, sizeof(buffer));
 	buffer[sizeof(buffer)-1] = '\0';
 	
--- a/erts/etc/common/escript.c
+++ b/erts/etc/common/escript.c
@@ -47,7 +47,7 @@
 #  define IS_DIRSEP(c) ((c) == '/')
 #  define DIRSEPSTR "/"
 #  define PATHSEPSTR ":"
-#  define PMAX PATH_MAX
+#  define PMAX MAXPATHLEN
 #  define ERL_NAME "erl"
 #endif
 
--- a/erts/etc/unix/dyn_erl.c
+++ b/erts/etc/unix/dyn_erl.c
@@ -144,8 +144,8 @@
 static char *
 find_prog(char *origpath)
 {
-    char relpath[PATH_MAX];
-    char abspath[PATH_MAX];
+    char relpath[MAXPATHLEN];
+    char abspath[MAXPATHLEN];
 
     strcpy(relpath, origpath);
 
@@ -156,7 +156,7 @@
         envpath = get_env("PATH");
         if (envpath) {
             /* Try to find the executable in the path */
-            char dir[PATH_MAX];
+            char dir[MAXPATHLEN];
             char *beg = envpath;
             char *end;
             int sz;
@@ -270,7 +270,7 @@
     /* List install dir and look for latest erts-vsn */
     DIR *dp;                    /* Pointer to directory structure. */
     struct dirent* dirp;        /* Pointer to directory entry.     */
-    char latest_vsn[PATH_MAX];  /* Latest erts-vsn directory name. */
+    char latest_vsn[MAXPATHLEN];/* Latest erts-vsn directory name. */
 
     dp = opendir(erl_top);
     if (dp == NULL) {
@@ -310,7 +310,7 @@
 
     char *p;
     char *p2;
-    char buffer[PATH_MAX];
+    char buffer[MAXPATHLEN];
 
     strcpy(buffer, erlpath);
 
@@ -353,9 +353,9 @@
     char *p;
     char *abspath;
     char *bindir;            /* Location of executables. */
-    char rootdir[PATH_MAX];  /* Root location of Erlang installation. */
-    char progname[PATH_MAX]; /* Name of this program. */
-    char erlexec[PATH_MAX];  /* Path to erlexec */
+    char rootdir[MAXPATHLEN];/* Root location of Erlang installation. */
+    char progname[MAXPATHLEN];/* Name of this program. */
+    char erlexec[MAXPATHLEN];/* Path to erlexec */
 
     /* Determine progname */
     abspath = find_prog(argv[0]);