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
|
$NetBSD: patch-ad,v 1.3 2004/08/22 23:27:16 jschauma Exp $
--- nettestd.c.orig 1992-11-05 16:52:58.000000000 -0500
+++ nettestd.c 2004-08-22 19:25:48.000000000 -0400
@@ -107,7 +107,12 @@
} name;
int namesize;
-int read(), recv();
+int read();
+#if defined(sgi) && _NO_XOPEN4 && _NO_XOPEN5
+int recv();
+#else
+ssize_t recv();
+#endif
int (*rfunc)() = read;
main(argc, argv)
@@ -271,7 +276,11 @@
# endif
#endif
if (daemon) {
+#ifdef NONVOID_SETPGRP
+ if (setpgrp(0, getpid()) < 0)
+#else
if (setpgrp() < 0)
+#endif
perror("setpgrp");
if ((c = open(_PATH_TTY, O_RDWR)) >= 0) {
(void)ioctl(c, TIOCNOTTY, (char *)0);
@@ -416,7 +425,7 @@
)
error("setsockopt (IP_OPTIONS)");
#endif
- if (bind(s, (char *)&name, namesize) < 0) {
+ if (bind(s, (struct sockaddr *)&name, namesize) < 0) {
error("bind");
exit(1);
}
@@ -447,10 +456,10 @@
#endif
listen(s, 5);
- signal(SIGCHLD, dochild);
+ signal(SIGCHLD, (void *)dochild);
for (;;) {
namesize = sizeof(name);
- s2 = accept(s, (char *)&name, &namesize);
+ s2 = accept(s, (struct sockaddr *)&name, &namesize);
if (s2 < 0) {
extern int errno;
if (errno == EINTR)
@@ -707,7 +716,9 @@
inmsg.msg_iovlen = 1;
inmsg.msg_name = (caddr_t)&name.d_inet;
inmsg.msg_control = (caddr_t)control;
+#ifndef sgi
inmsg.msg_flags = 0;
+#endif
errmsg = "recvmsg";
} else
#endif /* CMSG_DATA */
@@ -723,7 +734,7 @@
#endif
{
namesize = sizeof(name.d_inet);
- t = recvfrom(s, data, MAXSIZE, 0, (char *)&name.d_inet,
+ t = recvfrom(s, data, MAXSIZE, 0, (struct sockaddr *)&name.d_inet,
&namesize);
}
if (t < 0) {
|