File bootp-DD2-4.3-strict-aliasing-fix.diff of Package bootp-DD2
--- bootpd.c
+++ bootpd.c
@@ -215,7 +215,9 @@
struct hostent *hep;
char *stmp;
int n, ba_len, ra_len;
- int nfound, readfds;
+ int nfound;
+ fd_set readfds;
+
int standalone;
#ifdef SA_NOCLDSTOP /* Have POSIX sigaction(2). */
struct sigaction sa;
@@ -545,11 +547,12 @@
for (;;) {
struct timeval tv;
- readfds = 1 << s;
+ FD_ZERO(&readfds);
+ FD_SET(s, &readfds);
if (timeout)
tv = *timeout;
- nfound = select(s + 1, (fd_set *)&readfds, NULL, NULL,
+ nfound = select(s + 1, &readfds, NULL, NULL,
(timeout) ? &tv : NULL);
if (nfound < 0) {
if (errno != EINTR) {
@@ -569,7 +572,7 @@
}
continue;
}
- if (!(readfds & (1 << s))) {
+ if (!(FD_ISSET(s, &readfds))) {
if (debug > 1)
report(LOG_INFO, "exiting after %ld minutes of inactivity",
actualtimeout.tv_sec / 60);
--- bootpgw.c
+++ bootpgw.c
@@ -164,8 +164,9 @@
struct hostent *hep;
char *stmp;
int n, ba_len, ra_len;
- int nfound, readfds;
+ int nfound;
int standalone;
+ fd_set readfds;
progname = strrchr(argv[0], '/');
if (progname) progname++;
@@ -450,11 +451,13 @@
for (;;) {
struct timeval tv;
- readfds = 1 << s;
+ FD_ZERO(&readfds);
+ FD_SET(s, &readfds);
+
if (timeout)
tv = *timeout;
- nfound = select(s + 1, (fd_set *)&readfds, NULL, NULL,
+ nfound = select(s + 1, &readfds, NULL, NULL,
(timeout) ? &tv : NULL);
if (nfound < 0) {
if (errno != EINTR) {
@@ -462,7 +465,7 @@
}
continue;
}
- if (!(readfds & (1 << s))) {
+ if (! FD_ISSET(s, &readfds)) {
report(LOG_INFO, "exiting after %ld minutes of inactivity",
actualtimeout.tv_sec / 60);
exit(0);
--- bootptest.c
+++ bootptest.c
@@ -390,12 +390,13 @@
send_request(s);
while (1) {
struct timeval tv;
- int readfds;
+ fd_set readfds;
tv.tv_sec = WAITSECS;
tv.tv_usec = 0L;
- readfds = (1 << s);
- n = select(s + 1, (fd_set *) & readfds, NULL, NULL, &tv);
+ FD_ZERO(&readfds);
+ FD_SET(s, &readfds);
+ n = select(s + 1, &readfds, NULL, NULL, &tv);
if (n < 0) {
perror("select");
break;