aboutsummaryrefslogtreecommitdiff
path: root/libbb/pidfile.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-02 22:31:05 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-02 22:31:05 +0000
commit80edead5ea731c0c144def4d249eb88fb16001ef (patch)
tree1aca5341f9b412edd03f9edf32ea5f649a2bf242 /libbb/pidfile.c
parentc01af95c398b21203cd991917101e29b21821284 (diff)
downloadbusybox-w32-80edead5ea731c0c144def4d249eb88fb16001ef.tar.gz
busybox-w32-80edead5ea731c0c144def4d249eb88fb16001ef.tar.bz2
busybox-w32-80edead5ea731c0c144def4d249eb88fb16001ef.zip
udhcp: slight shrink
udhcpd_main 1171 1208 +37 udhcpc_main 2363 2387 +24 dhcprelay_main 1145 1146 +1 dhcprelay_stopflag 4 1 -3 dhcprelay_signal_handler 11 8 -3 client_background 46 42 -4 udhcp_read_interface 230 211 -19 udhcp_make_pidfile 76 - -76 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 3/4 up/down: 62/-105) Total: -43 bytes text data bss dec hex filename 770052 1096 11228 782376 bf028 busybox_old 769980 1096 11228 782304 befe0 busybox_unstripped
Diffstat (limited to 'libbb/pidfile.c')
-rw-r--r--libbb/pidfile.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbb/pidfile.c b/libbb/pidfile.c
index 50af91f4e..64e67c322 100644
--- a/libbb/pidfile.c
+++ b/libbb/pidfile.c
@@ -17,13 +17,15 @@ int write_pidfile(const char *path)
17 char *end; 17 char *end;
18 char buf[sizeof(int)*3 + 2]; 18 char buf[sizeof(int)*3 + 2];
19 19
20 if (!path)
21 return 1;
20 /* we will overwrite stale pidfile */ 22 /* we will overwrite stale pidfile */
21 pid_fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666); 23 pid_fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, 0666);
22 if (pid_fd < 0) 24 if (pid_fd < 0)
23 return 0; 25 return 0;
24 /* few bytes larger, but doesn't use stdio */ 26 /* few bytes larger, but doesn't use stdio */
25 end = utoa_to_buf(getpid(), buf, sizeof(buf)); 27 end = utoa_to_buf(getpid(), buf, sizeof(buf));
26 end[0] = '\n'; 28 *end = '\n';
27 full_write(pid_fd, buf, end - buf + 1); 29 full_write(pid_fd, buf, end - buf + 1);
28 close(pid_fd); 30 close(pid_fd);
29 return 1; 31 return 1;