diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-06 18:36:50 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-06 18:36:50 +0000 |
commit | 3538b9a8822421b7c8596a33a917dcf2f99c92b7 (patch) | |
tree | 768c23fe79bb81583de7376a4d744632d888d303 /networking/udhcp/files.c | |
parent | 5d725462d44268f9a86030daaa6f6396d32f796c (diff) | |
download | busybox-w32-3538b9a8822421b7c8596a33a917dcf2f99c92b7.tar.gz busybox-w32-3538b9a8822421b7c8596a33a917dcf2f99c92b7.tar.bz2 busybox-w32-3538b9a8822421b7c8596a33a917dcf2f99c92b7.zip |
Implement optional syslog logging using ordinary
bb_xx_msg calls, and convert networking/* to it.
The rest of bbox will be converted gradually.
Diffstat (limited to 'networking/udhcp/files.c')
-rw-r--r-- | networking/udhcp/files.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/networking/udhcp/files.c b/networking/udhcp/files.c index a0a3bfcd8..d9dfb8965 100644 --- a/networking/udhcp/files.c +++ b/networking/udhcp/files.c | |||
@@ -112,7 +112,7 @@ static void attach_option(struct option_set **opt_list, struct dhcp_option *opti | |||
112 | 112 | ||
113 | /* add it to an existing option */ | 113 | /* add it to an existing option */ |
114 | if ((existing = find_option(*opt_list, option->code))) { | 114 | if ((existing = find_option(*opt_list, option->code))) { |
115 | DEBUG(LOG_INFO, "Attaching option %s to existing member of list", option->name); | 115 | DEBUG("Attaching option %s to existing member of list", option->name); |
116 | if (option->flags & OPTION_LIST) { | 116 | if (option->flags & OPTION_LIST) { |
117 | if (existing->data[OPT_LEN] + length <= 255) { | 117 | if (existing->data[OPT_LEN] + length <= 255) { |
118 | existing->data = realloc(existing->data, | 118 | existing->data = realloc(existing->data, |
@@ -122,7 +122,7 @@ static void attach_option(struct option_set **opt_list, struct dhcp_option *opti | |||
122 | } /* else, ignore the data, we could put this in a second option in the future */ | 122 | } /* else, ignore the data, we could put this in a second option in the future */ |
123 | } /* else, ignore the new data */ | 123 | } /* else, ignore the new data */ |
124 | } else { | 124 | } else { |
125 | DEBUG(LOG_INFO, "Attaching option %s to list", option->name); | 125 | DEBUG("Attaching option %s to list", option->name); |
126 | 126 | ||
127 | /* make a new option */ | 127 | /* make a new option */ |
128 | new = xmalloc(sizeof(struct option_set)); | 128 | new = xmalloc(sizeof(struct option_set)); |
@@ -286,7 +286,7 @@ int read_config(const char *file) | |||
286 | keywords[i].handler(keywords[i].def, keywords[i].var); | 286 | keywords[i].handler(keywords[i].def, keywords[i].var); |
287 | 287 | ||
288 | if (!(in = fopen(file, "r"))) { | 288 | if (!(in = fopen(file, "r"))) { |
289 | LOG(LOG_ERR, "unable to open config file: %s", file); | 289 | bb_error_msg("Unable to open config file: %s", file); |
290 | return 0; | 290 | return 0; |
291 | } | 291 | } |
292 | 292 | ||
@@ -310,8 +310,9 @@ int read_config(const char *file) | |||
310 | for (i = 0; keywords[i].keyword[0]; i++) | 310 | for (i = 0; keywords[i].keyword[0]; i++) |
311 | if (!strcasecmp(token, keywords[i].keyword)) | 311 | if (!strcasecmp(token, keywords[i].keyword)) |
312 | if (!keywords[i].handler(line, keywords[i].var)) { | 312 | if (!keywords[i].handler(line, keywords[i].var)) { |
313 | LOG(LOG_ERR, "Failure parsing line %d of %s", lm, file); | 313 | bb_error_msg("Failure parsing line %d of %s", lm, file); |
314 | DEBUG(LOG_ERR, "unable to parse '%s'", debug_orig); | 314 | if (ENABLE_FEATURE_UDHCP_DEBUG) |
315 | bb_error_msg("unable to parse '%s'", debug_orig); | ||
315 | /* reset back to the default value */ | 316 | /* reset back to the default value */ |
316 | keywords[i].handler(keywords[i].def, keywords[i].var); | 317 | keywords[i].handler(keywords[i].def, keywords[i].var); |
317 | } | 318 | } |
@@ -330,7 +331,7 @@ void write_leases(void) | |||
330 | unsigned long tmp_time; | 331 | unsigned long tmp_time; |
331 | 332 | ||
332 | if (!(fp = fopen(server_config.lease_file, "w"))) { | 333 | if (!(fp = fopen(server_config.lease_file, "w"))) { |
333 | LOG(LOG_ERR, "Unable to open %s for writing", server_config.lease_file); | 334 | bb_error_msg("Unable to open %s for writing", server_config.lease_file); |
334 | return; | 335 | return; |
335 | } | 336 | } |
336 | 337 | ||
@@ -368,7 +369,7 @@ void read_leases(const char *file) | |||
368 | struct dhcpOfferedAddr lease; | 369 | struct dhcpOfferedAddr lease; |
369 | 370 | ||
370 | if (!(fp = fopen(file, "r"))) { | 371 | if (!(fp = fopen(file, "r"))) { |
371 | LOG(LOG_ERR, "Unable to open %s for reading", file); | 372 | bb_error_msg("Unable to open %s for reading", file); |
372 | return; | 373 | return; |
373 | } | 374 | } |
374 | 375 | ||
@@ -378,12 +379,12 @@ void read_leases(const char *file) | |||
378 | lease.expires = ntohl(lease.expires); | 379 | lease.expires = ntohl(lease.expires); |
379 | if (!server_config.remaining) lease.expires -= time(0); | 380 | if (!server_config.remaining) lease.expires -= time(0); |
380 | if (!(add_lease(lease.chaddr, lease.yiaddr, lease.expires))) { | 381 | if (!(add_lease(lease.chaddr, lease.yiaddr, lease.expires))) { |
381 | LOG(LOG_WARNING, "Too many leases while loading %s\n", file); | 382 | bb_error_msg("Too many leases while loading %s", file); |
382 | break; | 383 | break; |
383 | } | 384 | } |
384 | i++; | 385 | i++; |
385 | } | 386 | } |
386 | } | 387 | } |
387 | DEBUG(LOG_INFO, "Read %d leases", i); | 388 | DEBUG("Read %d leases", i); |
388 | fclose(fp); | 389 | fclose(fp); |
389 | } | 390 | } |