aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl/0001-v1.1.4-to-d86af2a0.patch
blob: e29d0ae98199de49fd01a402963b3e96ee6eb8ef (plain)
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
diff --git a/include/ctype.h b/include/ctype.h
index 8f0d168..a6f44df 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -22,13 +22,18 @@ int   isxdigit(int);
 int   tolower(int);
 int   toupper(int);
 
+static __inline int __isspace(int _c)
+{
+	return _c == ' ' || (unsigned)_c-'\t' < 5;
+}
+
 #define isalpha(a) ((((unsigned)(a)|32)-'a') < 26)
 #define isdigit(a) (((unsigned)(a)-'0') < 10)
 #define islower(a) (((unsigned)(a)-'a') < 26)
 #define isupper(a) (((unsigned)(a)-'A') < 26)
 #define isprint(a) (((unsigned)(a)-0x20) < 0x5f)
 #define isgraph(a) (((unsigned)(a)-0x21) < 0x5e)
-
+#define isspace(a) __isspace(a)
 
 
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
diff --git a/include/sched.h b/include/sched.h
index 4394b64..3e34a72 100644
--- a/include/sched.h
+++ b/include/sched.h
@@ -123,7 +123,7 @@ __CPU_op_func_S(XOR, ^)
 #define CPU_XOR(d,s1,s2) CPU_XOR_S(sizeof(cpu_set_t),d,s1,s2)
 #define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t),set)
 #define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
-#define CPU_EQUAL(set) CPU_EQUAL_S(sizeof(cpu_set_t),set)
+#define CPU_EQUAL(s1,s2) CPU_EQUAL_S(sizeof(cpu_set_t),s1,s2)
 
 #endif
 
diff --git a/include/stdlib.h b/include/stdlib.h
index f034c6e..db569d9 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -144,12 +144,12 @@ int mkostemps (char *, int, int);
 void *valloc (size_t);
 void *memalign(size_t, size_t);
 int getloadavg(double *, int);
+int clearenv(void);
 #define WCOREDUMP(s) ((s) & 0x80)
 #define WIFCONTINUED(s) ((s) == 0xffff)
 #endif
 
 #ifdef _GNU_SOURCE
-int clearenv(void);
 int ptsname_r(int, char *, size_t);
 char *ecvt(double, int, int *, int *);
 char *fcvt(double, int, int *, int *);
diff --git a/src/ctype/isspace.c b/src/ctype/isspace.c
index 7dff20d..231e907 100644
--- a/src/ctype/isspace.c
+++ b/src/ctype/isspace.c
@@ -1,5 +1,6 @@
 #include <ctype.h>
 #include "libc.h"
+#undef isspace
 
 int isspace(int c)
 {
diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c
index 6cca968..ddc2a73 100644
--- a/src/env/__init_tls.c
+++ b/src/env/__init_tls.c
@@ -91,12 +91,11 @@ void __init_tls(size_t *aux)
 	libc.tls_size = 2*sizeof(void *)+T.size+T.align+sizeof(struct pthread);
 
 	if (libc.tls_size > sizeof builtin_tls) {
+#ifndef SYS_mmap2
+#define SYS_mmap2 SYS_mmap
+#endif
 		mem = (void *)__syscall(
-#ifdef SYS_mmap2
 			SYS_mmap2,
-#else
-			SYS_mmap,
-#endif
 			0, libc.tls_size, PROT_READ|PROT_WRITE,
 			MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
 		/* -4095...-1 cast to void * will crash on dereference anyway,
diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c
index 12f14f7..c90fe99 100644
--- a/src/ldso/dynlink.c
+++ b/src/ldso/dynlink.c
@@ -1603,10 +1603,14 @@ static int invalid_dso_handle(void *h)
 }
 void *dlopen(const char *file, int mode)
 {
+	strcpy(errbuf, "Dynamic loading not supported");
+	errflag = 1;
 	return 0;
 }
 void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra)
 {
+	errflag = 1;
+	snprintf(errbuf, sizeof errbuf, "Symbol not found: %s", s);
 	return 0;
 }
 int __dladdr (const void *addr, Dl_info *info)
diff --git a/src/locale/pleval.c b/src/locale/pleval.c
index 961dabc..d60058d 100644
--- a/src/locale/pleval.c
+++ b/src/locale/pleval.c
@@ -28,14 +28,6 @@ struct st {
 	int op;
 };
 
-/* TODO: this should go into ctypes.h */
-#undef isspace
-#define isspace(a) __isspace(a)
-static __inline int __isspace(int _c)
-{
-	return _c == ' ' || (unsigned)_c-'\t' < 5;
-}
-
 static const char *skipspace(const char *s)
 {
 	while (isspace(*s)) s++;
diff --git a/src/misc/mntent.c b/src/misc/mntent.c
index 3eafba5..a16d652 100644
--- a/src/misc/mntent.c
+++ b/src/misc/mntent.c
@@ -10,7 +10,7 @@ FILE *setmntent(const char *name, const char *mode)
 
 int endmntent(FILE *f)
 {
-	fclose(f);
+	if (f) fclose(f);
 	return 1;
 }