summaryrefslogtreecommitdiff
path: root/networking/dnsd.c
diff options
context:
space:
mode:
authorRob Landley2006-05-29 06:43:55 +0000
committerRob Landley2006-05-29 06:43:55 +0000
commita6e131dab39ee67522687a56b39ed815b9ae15ec (patch)
tree1ca2de8c070d79096f6db1a4a614d00a0ef7800d /networking/dnsd.c
parentbba7f08d2788bc9bc30a7a60fdfd873a73fead9a (diff)
downloadbusybox-a6e131dab39ee67522687a56b39ed815b9ae15ec.zip
busybox-a6e131dab39ee67522687a56b39ed815b9ae15ec.tar.gz
Size reductions, mostly switching things to use libbb functions.
Diffstat (limited to 'networking/dnsd.c')
-rw-r--r--networking/dnsd.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/networking/dnsd.c b/networking/dnsd.c
index b9d0221..58a8fc1 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -82,8 +82,7 @@ static uint32_t ttl = DEFAULT_TTL;
/*
* Convert host name from C-string to dns length/string.
*/
-static void
-convname(char *a, uint8_t *q)
+static void convname(char *a, uint8_t *q)
{
int i = (q[0] == '.') ? 0 : 1;
for(; i < MAX_HOST_LEN-1 && *q; i++, q++)
@@ -95,8 +94,7 @@ convname(char *a, uint8_t *q)
/*
* Insert length of substrings insetad of dots
*/
-static void
-undot(uint8_t * rip)
+static void undot(uint8_t * rip)
{
int i = 0, s = 0;
while(rip[i]) i++;
@@ -111,8 +109,7 @@ undot(uint8_t * rip)
/*
* Append message to log file
*/
-static void
-log_message(char *filename, char *message)
+static void log_message(char *filename, char *message)
{
FILE *logfile;
if (!daemonmode)
@@ -133,8 +130,7 @@ log_message(char *filename, char *message)
* converting to a length/string substring for that label.
*/
-static int
-getfileentry(FILE * fp, struct dns_entry *s, int verb)
+static int getfileentry(FILE * fp, struct dns_entry *s, int verb)
{
unsigned int a,b,c,d;
char *r, *name;
@@ -168,19 +164,16 @@ restart:
/*
* Read hostname/IP records from file
*/
-static void
-dnsentryinit(int verb)
+static void dnsentryinit(int verb)
{
FILE *fp;
struct dns_entry *m, *prev;
prev = dnsentry = NULL;
- if(!(fp = fopen(fileconf, "r")))
- bb_perror_msg_and_die("open %s",fileconf);
+ fp = bb_xfopen(fileconf, "r");
while (1) {
- if(!(m = (struct dns_entry *)malloc(sizeof(struct dns_entry))))
- bb_perror_msg_and_die("malloc dns_entry");
+ m = xmalloc(sizeof(struct dns_entry));
m->next = NULL;
if (getfileentry(fp, m, verb))
@@ -199,8 +192,7 @@ dnsentryinit(int verb)
/*
* Set up UDP socket
*/
-static int
-listen_socket(char *iface_addr, int listen_port)
+static int listen_socket(char *iface_addr, int listen_port)
{
struct sockaddr_in a;
char msg[100];
@@ -228,8 +220,7 @@ listen_socket(char *iface_addr, int listen_port)
* Look query up in dns records and return answer if found
* qs is the query string, first byte the string length
*/
-static int
-table_lookup(uint16_t type, uint8_t * as, uint8_t * qs)
+static int table_lookup(uint16_t type, uint8_t * as, uint8_t * qs)
{
int i;
struct dns_entry *d=dnsentry;
@@ -269,8 +260,7 @@ table_lookup(uint16_t type, uint8_t * as, uint8_t * qs)
* Decode message and generate answer
*/
#define eret(s) do { fprintf (stderr, "%s\n", s); return -1; } while (0)
-static int
-process_packet(uint8_t * buf)
+static int process_packet(uint8_t * buf)
{
struct dns_head *head;
struct dns_prop *qprop;
@@ -367,8 +357,7 @@ process_packet(uint8_t * buf)
/*
* Exit on signal
*/
-static void
-interrupt(int x)
+static void interrupt(int x)
{
unlink(LOCK_FILE);
write(2, "interrupt exiting\n", 18);