summaryrefslogtreecommitdiffstats
path: root/main/musl/0003-3fa2eb2a-to-70d9c303.patch
blob: f2d218cee038696450fb17c7ebac8ff1fb1ba73c (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
diff --git a/configure b/configure
index 0cff13d..b1cf998 100755
--- a/configure
+++ b/configure
@@ -298,12 +298,9 @@ fi
 tryflag CFLAGS_MEMOPS -fno-tree-loop-distribute-patterns
 
 #
-# If debugging is explicitly enabled, don't auto-enable optimizations
+# Enable debugging if requessted.
 #
-if test "$debug" = yes ; then
-CFLAGS_AUTO=-g
-test "$optimize" = auto && optimize=no
-fi
+test "$debug" = yes && CFLAGS_AUTO=-g
 
 #
 # Possibly add a -O option to CFLAGS and select modules to optimize with
diff --git a/include/syslog.h b/include/syslog.h
index 71dbd99..5b4d296 100644
--- a/include/syslog.h
+++ b/include/syslog.h
@@ -69,21 +69,17 @@ void vsyslog (int, const char *, va_list);
 #if defined(SYSLOG_NAMES)
 #define	INTERNAL_NOPRI 0x10
 #define	INTERNAL_MARK (LOG_NFACILITIES<<3)
-struct __CODE {
-	const char *c_name;
-	int c_val;
-};
 typedef struct {
 	char *c_name;
 	int c_val;
 } CODE;
-#define prioritynames ((CODE *)(const struct __CODE []){ \
+#define prioritynames ((CODE *)(const CODE []){ \
 	{ "alert", LOG_ALERT }, { "crit", LOG_CRIT }, { "debug", LOG_DEBUG }, \
 	{ "emerg", LOG_EMERG }, { "err", LOG_ERR }, { "error", LOG_ERR }, \
 	{ "info", LOG_INFO }, { "none", INTERNAL_NOPRI }, \
 	{ "notice", LOG_NOTICE }, { "panic", LOG_EMERG }, \
 	{ "warn", LOG_WARNING }, { "warning", LOG_WARNING }, { 0, -1 } })
-#define facilitynames ((CODE *)(const struct __CODE []){ \
+#define facilitynames ((CODE *)(const CODE []){ \
 	{ "auth", LOG_AUTH }, { "authpriv", LOG_AUTHPRIV }, \
 	{ "cron", LOG_CRON }, { "daemon", LOG_DAEMON }, { "ftp", LOG_FTP }, \
 	{ "kern", LOG_KERN }, { "lpr", LOG_LPR }, { "mail", LOG_MAIL }, \
diff --git a/src/network/gethostbyaddr_r.c b/src/network/gethostbyaddr_r.c
index 73e7644..66e0330 100644
--- a/src/network/gethostbyaddr_r.c
+++ b/src/network/gethostbyaddr_r.c
@@ -18,6 +18,8 @@ int gethostbyaddr_r(const void *a, socklen_t l, int af,
 	socklen_t sl = af==AF_INET6 ? sizeof sa.sin6 : sizeof sa.sin;
 	int i;
 
+	*res = 0;
+
 	/* Load address argument into sockaddr structure */
 	if (af==AF_INET6 && l==16) memcpy(&sa.sin6.sin6_addr, a, 16);
 	else if (af==AF_INET && l==4) memcpy(&sa.sin.sin_addr, a, 4);
diff --git a/src/network/gethostbyname2_r.c b/src/network/gethostbyname2_r.c
index aa8b0a9..81f71d2 100644
--- a/src/network/gethostbyname2_r.c
+++ b/src/network/gethostbyname2_r.c
@@ -17,6 +17,7 @@ int gethostbyname2_r(const char *name, int af,
 	int i, cnt;
 	size_t align, need;
 
+	*res = 0;
 	cnt = __lookup_name(addrs, canon, name, af, AI_CANONNAME);
 	if (cnt<0) switch (cnt) {
 	case EAI_NONAME:
diff --git a/src/network/sendmmsg.c b/src/network/sendmmsg.c
index ff9f861..eeae1d0 100644
--- a/src/network/sendmmsg.c
+++ b/src/network/sendmmsg.c
@@ -12,6 +12,7 @@ int sendmmsg(int fd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int fla
 	 * and the cmsg blocks cannot be modified in-place. */
 	int i;
 	if (vlen > IOV_MAX) vlen = IOV_MAX; /* This matches the kernel. */
+	if (!vlen) return 0;
 	for (i=0; i<vlen; i++) {
 		/* As an unfortunate inconsistency, the sendmmsg API uses
 		 * unsigned int for the resulting msg_len, despite sendmsg