summaryrefslogtreecommitdiff
path: root/networking/udhcp/common.c
diff options
context:
space:
mode:
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 76f8bf703..108ab2e95 100644
--- a/networking/udhcp/common.c
+++ b/networking/udhcp/common.c
@@ -10,31 +10,10 @@
10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 10 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
11 */ 11 */
12 12
13#include <syslog.h>
14
15#include "common.h" 13#include "common.h"
16 14
17
18const uint8_t MAC_BCAST_ADDR[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 15const uint8_t MAC_BCAST_ADDR[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
19 16
20long uptime(void)
21{
22 struct sysinfo info;
23 sysinfo(&info);
24 return info.uptime;
25}
26
27static void create_pidfile(const char *pidfile)
28{
29 if (!pidfile)
30 return;
31
32 if (!write_pidfile(pidfile)) {
33 bb_perror_msg("cannot create pidfile %s", pidfile);
34 return;
35 }
36}
37
38void udhcp_make_pidfile(const char *pidfile) 17void udhcp_make_pidfile(const char *pidfile)
39{ 18{
40 /* Make sure fd 0,1,2 are open */ 19 /* Make sure fd 0,1,2 are open */
@@ -44,7 +23,8 @@ void udhcp_make_pidfile(const char *pidfile)
44 setlinebuf(stdout); 23 setlinebuf(stdout);
45 24
46 /* Create pidfile */ 25 /* Create pidfile */
47 create_pidfile(pidfile); 26 if (pidfile && !write_pidfile(pidfile))
27 bb_perror_msg("cannot create pidfile %s", pidfile);
48 28
49 bb_info_msg("%s (v%s) started", applet_name, BB_VER); 29 bb_info_msg("%s (v%s) started", applet_name, BB_VER);
50} 30}