aboutsummaryrefslogtreecommitdiff
path: root/networking/dnsd.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-08-03 17:58:17 +0000
committerRob Landley <rob@landley.net>2006-08-03 17:58:17 +0000
commit86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74 (patch)
treeb3002e01131f99581c1be3462b96b2f2c40408f4 /networking/dnsd.c
parent7478804b783619762a52a740037126ef8711acc2 (diff)
downloadbusybox-w32-86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74.tar.gz
busybox-w32-86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74.tar.bz2
busybox-w32-86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74.zip
These should have been part of 15767 too.
Diffstat (limited to 'networking/dnsd.c')
-rw-r--r--networking/dnsd.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/networking/dnsd.c b/networking/dnsd.c
index f8bd07e10..ec604e0e0 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -17,12 +17,6 @@
17 * the first porting of oao' scdns to busybox also. 17 * the first porting of oao' scdns to busybox also.
18 */ 18 */
19 19
20#include <unistd.h>
21#include <string.h>
22#include <signal.h>
23#include <arpa/inet.h>
24#include <sys/socket.h>
25#include <ctype.h>
26#include "busybox.h" 20#include "busybox.h"
27 21
28static char *fileconf = "/etc/dnsd.conf"; 22static char *fileconf = "/etc/dnsd.conf";
@@ -170,7 +164,7 @@ static void dnsentryinit(int verb)
170 struct dns_entry *m, *prev; 164 struct dns_entry *m, *prev;
171 prev = dnsentry = NULL; 165 prev = dnsentry = NULL;
172 166
173 fp = bb_xfopen(fileconf, "r"); 167 fp = xfopen(fileconf, "r");
174 168
175 while (1) { 169 while (1) {
176 m = xmalloc(sizeof(struct dns_entry)); 170 m = xmalloc(sizeof(struct dns_entry));
@@ -198,7 +192,7 @@ static int listen_socket(char *iface_addr, int listen_port)
198 char msg[100]; 192 char msg[100];
199 int s; 193 int s;
200 int yes = 1; 194 int yes = 1;
201 s = bb_xsocket(PF_INET, SOCK_DGRAM, 0); 195 s = xsocket(PF_INET, SOCK_DGRAM, 0);
202#ifdef SO_REUSEADDR 196#ifdef SO_REUSEADDR
203 if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0) 197 if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char *)&yes, sizeof(yes)) < 0)
204 bb_perror_msg_and_die("setsockopt() failed"); 198 bb_perror_msg_and_die("setsockopt() failed");
@@ -208,8 +202,8 @@ static int listen_socket(char *iface_addr, int listen_port)
208 a.sin_family = AF_INET; 202 a.sin_family = AF_INET;
209 if (!inet_aton(iface_addr, &a.sin_addr)) 203 if (!inet_aton(iface_addr, &a.sin_addr))
210 bb_perror_msg_and_die("bad iface address"); 204 bb_perror_msg_and_die("bad iface address");
211 bb_xbind(s, (struct sockaddr *)&a, sizeof(a)); 205 xbind(s, (struct sockaddr *)&a, sizeof(a));
212 listen(s, 50); /* bb_xlisten? */ 206 xlisten(s, 50); /* xlisten? */
213 sprintf(msg, "accepting UDP packets on addr:port %s:%d\n", 207 sprintf(msg, "accepting UDP packets on addr:port %s:%d\n",
214 iface_addr, (int)listen_port); 208 iface_addr, (int)listen_port);
215 log_message(LOG_FILE, msg); 209 log_message(LOG_FILE, msg);
@@ -397,7 +391,7 @@ int dnsd_main(int argc, char **argv)
397 /* reexec for vfork() do continue parent */ 391 /* reexec for vfork() do continue parent */
398 vfork_daemon_rexec(1, 0, argc, argv, "-d"); 392 vfork_daemon_rexec(1, 0, argc, argv, "-d");
399#else 393#else
400 bb_xdaemon(1, 0); 394 xdaemon(1, 0);
401#endif 395#endif
402 396
403 dnsentryinit(is_verbose()); 397 dnsentryinit(is_verbose());