scummvm random work
[patches.git] / iputils-socklen.patch
1 Use socklen_t in all the right places.
2
3 Signed-off-by: Mike Frysinger <vapier@gentoo.org>
4
5 diff --git a/arping.c b/arping.c
6 index 73a7e6f..86f1607 100644
7 --- a/arping.c
8 +++ b/arping.c
9 @@ -439,7 +439,7 @@ main(int argc, char **argv)
10 }
11 } else if (!dad) {
12 int on = 1;
13 - int alen = sizeof(saddr);
14 + socklen_t alen = sizeof(saddr);
15
16 saddr.sin_port = htons(1025);
17 saddr.sin_addr = dst;
18 @@ -468,7 +468,7 @@ main(int argc, char **argv)
19 }
20
21 if (1) {
22 - int alen = sizeof(me);
23 + socklen_t alen = sizeof(me);
24 if (getsockname(s, (struct sockaddr*)&me, &alen) == -1) {
25 perror("getsockname");
26 exit(2);
27 @@ -500,9 +500,9 @@ main(int argc, char **argv)
28
29 while(1) {
30 sigset_t sset, osset;
31 - char packet[4096];
32 + unsigned char packet[4096];
33 struct sockaddr_ll from;
34 - int alen = sizeof(from);
35 + socklen_t alen = sizeof(from);
36 int cc;
37
38 if ((cc = recvfrom(s, packet, sizeof(packet), 0,
39 diff --git a/clockdiff.c b/clockdiff.c
40 index 009eed4..e17e0b8 100644
41 --- a/clockdiff.c
42 +++ b/clockdiff.c
43 @@ -121,7 +121,7 @@ long rtt_sigma = 0;
44 int
45 measure(struct sockaddr_in * addr)
46 {
47 - int length;
48 + socklen_t length;
49 int msgcount;
50 int cc, count;
51 fd_set ready;
52 @@ -299,7 +299,7 @@ char *myname, *hisname;
53 int
54 measure_opt(struct sockaddr_in * addr)
55 {
56 - int length;
57 + socklen_t length;
58 int msgcount;
59 int cc, count;
60 fd_set ready;
61 @@ -602,7 +602,7 @@ main(int argc, char *argv[])
62 }
63 if (ip_opt_len) {
64 struct sockaddr_in myaddr;
65 - int addrlen = sizeof(myaddr);
66 + socklen_t addrlen = sizeof(myaddr);
67 unsigned char rspace[ip_opt_len];
68
69 bzero(rspace, sizeof(rspace));
70 diff --git a/ping.c b/ping.c
71 index 825f85b..561e71a 100644
72 --- a/ping.c
73 +++ b/ping.c
74 @@ -259,7 +259,7 @@ main(int argc, char **argv)
75 }
76
77 if (source.sin_addr.s_addr == 0) {
78 - int alen;
79 + socklen_t alen;
80 struct sockaddr_in dst = whereto;
81 int probe_fd = socket(AF_INET, SOCK_DGRAM, 0);
82
83 diff --git a/ping6.c b/ping6.c
84 index 5aef459..d85a659 100644
85 --- a/ping6.c
86 +++ b/ping6.c
87 @@ -344,7 +344,7 @@ int main(int argc, char *argv[])
88 hostname = target;
89
90 if (ipv6_addr_any(&source.sin6_addr)) {
91 - int alen;
92 + socklen_t alen;
93 int probe_fd = socket(AF_INET6, SOCK_DGRAM, 0);
94
95 if (probe_fd < 0) {
96 diff --git a/ping_common.c b/ping_common.c
97 index dd111f7..acd9b8e 100644
98 --- a/ping_common.c
99 +++ b/ping_common.c
100 @@ -67,7 +67,7 @@ static void fill(char *patp)
101 int ii, jj, kk;
102 int pat[16];
103 char *cp;
104 - char *bp = outpack+8;
105 + u_char *bp = outpack+8;
106
107 for (cp = patp; *cp; cp++) {
108 if (!isxdigit(*cp)) {
109 @@ -393,7 +393,7 @@ resend:
110 void sock_setbufs(int icmp_sock, int alloc)
111 {
112 int rcvbuf, hold;
113 - int tmplen = sizeof(hold);
114 + socklen_t tmplen = sizeof(hold);
115
116 if (!sndbuf)
117 sndbuf = alloc;
118 @@ -464,7 +464,7 @@ void setup(int icmp_sock)
119
120 if (!(options & F_PINGFILLED)) {
121 int i;
122 - char *p = outpack+8;
123 + u_char *p = outpack+8;
124
125 /* Do not forget about case of small datalen,
126 * fill timestamp area too!
127 diff --git a/rarpd.c b/rarpd.c
128 index 5cb0ab8..65fd57f 100644
129 --- a/rarpd.c
130 +++ b/rarpd.c
131 @@ -417,7 +417,7 @@ void serve_it(int fd)
132 {
133 unsigned char buf[1024];
134 struct sockaddr_ll sll;
135 - int sll_len = sizeof(sll);
136 + socklen_t sll_len = sizeof(sll);
137 struct arphdr *a = (struct arphdr*)buf;
138 struct rarp_map *rmap;
139 unsigned char *ptr;
140 diff --git a/rdisc.c b/rdisc.c
141 index 5f598e2..dc52b3e 100644
142 --- a/rdisc.c
143 +++ b/rdisc.c
144 @@ -451,7 +451,7 @@ next:
145 for (;;) {
146 u_char packet[MAXPACKET];
147 int len = sizeof (packet);
148 - int fromlen = sizeof (from);
149 + socklen_t fromlen = sizeof (from);
150 int cc;
151
152 cc=recvfrom(s, (char *)packet, len, 0,
153 diff --git a/tftpd.c b/tftpd.c
154 index 301151e..39f2164 100644
155 --- a/tftpd.c
156 +++ b/tftpd.c
157 @@ -88,7 +88,7 @@ union {
158 struct sockaddr_in sin;
159 struct sockaddr_in6 sin6;
160 } from;
161 -int fromlen;
162 +socklen_t fromlen;
163
164 #define MAXARG 1
165 char *dirs[MAXARG+1];
166 @@ -148,7 +148,8 @@ int main(int ac, char **av)
167 */
168 {
169 int pid;
170 - int i, j;
171 + int i;
172 + socklen_t j;
173
174 for (i = 1; i < 20; i++) {
175 pid = fork();
176 diff --git a/traceroute6.c b/traceroute6.c
177 index fdb631f..114cb0a 100644
178 --- a/traceroute6.c
179 +++ b/traceroute6.c
180 @@ -510,7 +510,7 @@ int main(int argc, char *argv[])
181 (char *)&on, sizeof(on));
182
183 if (source == NULL) {
184 - int alen;
185 + socklen_t alen;
186 int probe_fd = socket(AF_INET6, SOCK_DGRAM, 0);
187
188 if (probe_fd < 0) {