summaryrefslogtreecommitdiffstats
path: root/main/mailx/musl-fix.patch
blob: 8b409b286d5e06c058c88d67cddb6ae668964533 (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
--- mailx-8.1.1-fixed.orig/cmd2.c
+++ mailx-8.1.1-fixed/cmd2.c
@@ -383,7 +383,7 @@
 	void *v;
 {
 	int pid;
-	extern union wait wait_status;
+	extern int wait_status;
 
 	switch (pid = vfork()) {
 	case -1:
@@ -396,7 +396,7 @@
 	printf("Okie dokie");
 	fflush(stdout);
 	wait_child(pid);
-	if (wait_status.w_coredump)
+	if (WCOREDUMP(wait_status))
 		printf(" -- Core dumped.\n");
 	else
 		printf(" -- Can't dump core.\n");
--- mailx-8.1.1-fixed.orig/def.h
+++ mailx-8.1.1-fixed/def.h
@@ -43,6 +43,7 @@
  */
 
 #include <sys/param.h>
+#include <sys/cdefs.h>
 #include <sys/stat.h>
 #include <sys/time.h>
 
--- mailx-8.1.1-fixed.orig/extern.h
+++ mailx-8.1.1-fixed/extern.h
@@ -37,6 +37,8 @@
  *	$NetBSD: extern.h,v 1.4 1996/06/08 19:48:21 christos Exp $
  */
 
+#include <sys/cdefs.h>
+
 struct name;
 struct name *cat __P((struct name *, struct name *));
 struct name *delname __P((struct name *, char []));
--- mailx-8.1.1-fixed.orig/fio.c
+++ mailx-8.1.1-fixed/fio.c
@@ -47,7 +47,6 @@
 #include <sys/wait.h>
 
 #include <unistd.h>
-#include <paths.h>
 #include <errno.h>
 #include "extern.h"
 
@@ -326,7 +325,7 @@
 	register char *cp, *shell;
 	int pivec[2];
 	struct stat sbuf;
-	extern union wait wait_status;
+	extern int wait_status;
 
 	/*
 	 * The order of evaluation is "%" and "#" expand into constants.
@@ -378,7 +377,7 @@
 	close(pivec[1]);
 	l = read(pivec[0], xname, BUFSIZ);
 	close(pivec[0]);
-	if (wait_child(pid) < 0 && wait_status.w_termsig != SIGPIPE) {
+	if (wait_child(pid) < 0 && WIFSIGNALED(wait_status) && WTERMSIG(wait_status) != SIGPIPE) {
 		fprintf(stderr, "\"%s\": Expansion failed.\n", name);
 		return NOSTR;
 	}
--- mailx-8.1.1-fixed.orig/pathnames.h
+++ mailx-8.1.1-fixed/pathnames.h
@@ -44,3 +44,4 @@
 #define	_PATH_TILDE	"/usr/share/misc/mail.tildehelp"
 #define	_PATH_MASTER_RC	"/etc/mail.rc"
 #define	_PATH_MORE	"/usr/bin/more"
+#define	_PATH_CSHELL	"/bin/csh"
--- mailx-8.1.1-fixed.orig/popen.c
+++ mailx-8.1.1-fixed/popen.c
@@ -62,7 +62,7 @@
 	int pid;
 	char done;
 	char free;
-	union wait status;
+	int status;
 	struct child *link;
 };
 static struct child *child;
@@ -341,7 +341,7 @@
 	int signo;
 {
 	int pid;
-	union wait status;
+	int status;
 	register struct child *cp;
 
 	while ((pid =
@@ -356,7 +356,7 @@
 	}
 }
 
-union wait wait_status;
+int wait_status;
 
 /*
  * Wait for a specific child to die.
@@ -376,7 +376,9 @@
 	wait_status = cp->status;
 	delchild(cp);
 	sigprocmask(SIG_SETMASK, &oset, NULL);
-	return wait_status.w_status ? -1 : 0;
+	if (WIFEXITED(wait_status) && WEXITSTATUS(wait_status) == 0)
+		return 0;
+	return -1;
 }
 
 /*
--- mailx-8.1.1-fixed.orig/quit.c
+++ mailx-8.1.1-fixed/quit.c
@@ -43,6 +43,7 @@
 #endif /* not lint */
 
 #include "rcv.h"
+#include <sys/file.h>
 #include <fcntl.h>
 #include "extern.h"