summaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-07-03 15:47:50 +0000
committerDenis Vlasenko2007-07-03 15:47:50 +0000
commit42b3dea9bfb8ac595c71089ee23012f44dd43eb2 (patch)
treeb7b86d06a574d2af72bc79536d399905b5619959 /networking/udhcp/common.c
parent54e19da86d5496ec5f5787b85a2b6342be1d63d4 (diff)
downloadbusybox-42b3dea9bfb8ac595c71089ee23012f44dd43eb2.zip
busybox-42b3dea9bfb8ac595c71089ee23012f44dd43eb2.tar.gz
udhcp: many small fixes:
* arpping(): smaller and even probably fixed * lots of variables/params converted: ulong -> uint32_t * uptime() nuked in favor of monotonic_sec() * udhcp_get_packet(): only one "bad vendor", simplify function old new delta reservedIp 36 35 -1 udhcpc_main 2462 2460 -2 addStaticLease 64 62 -2 static.broken_vendors 16 - -16 uptime 19 - -19 udhcpd_main 1273 1238 -35 udhcp_get_packet 223 184 -39 .rodata 144162 144106 -56 arpping 690 609 -81 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/7 up/down: 0/-251) Total: -251 bytes text data bss dec hex filename 734241 3028 14400 751669 b7835 busybox_old 734005 3028 14400 751433 b7749 busybox_unstripped
Diffstat (limited to 'networking/udhcp/common.c')
-rw-r--r--networking/udhcp/common.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/networking/udhcp/common.c b/networking/udhcp/common.c
index 76f8bf7..108ab2e 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -10,31 +10,10 @@
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
-#include <syslog.h>
-
#include "common.h"
-
const uint8_t MAC_BCAST_ADDR[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-long uptime(void)
-{
- struct sysinfo info;
- sysinfo(&info);
- return info.uptime;
-}
-
-static void create_pidfile(const char *pidfile)
-{
- if (!pidfile)
- return;
-
- if (!write_pidfile(pidfile)) {
- bb_perror_msg("cannot create pidfile %s", pidfile);
- return;
- }
-}
-
void udhcp_make_pidfile(const char *pidfile)
{
/* Make sure fd 0,1,2 are open */
@@ -44,7 +23,8 @@ void udhcp_make_pidfile(const char *pidfile)
setlinebuf(stdout);
/* Create pidfile */
- create_pidfile(pidfile);
+ if (pidfile && !write_pidfile(pidfile))
+ bb_perror_msg("cannot create pidfile %s", pidfile);
bb_info_msg("%s (v%s) started", applet_name, BB_VER);
}