summaryrefslogtreecommitdiff
path: root/packages/busybox/busybox-1.00/udhcppidfile-breakage.patch
blob: 031274908bc13f18dfd297e30f7496cbf0cbf279 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- busybox-1.00/networking/udhcp/common.c~udhcppidfile2
+++ busybox-1.00/networking/udhcp/common.c
@@ -74,7 +74,7 @@
 
 	if (pid > 0) {
 		/* parent */
-		if (pidfile_reassign(pidfile, pid) < 0) {
+		if (pidfile != NULL && pidfile_reassign(pidfile, pid) < 0) {
 			(void)kill(pid, SIGKILL);
 			exit(1);
 		} else
@@ -119,7 +119,7 @@
 	sanitize_fds();
 
 	/* do some other misc startup stuff while we are here to save bytes */
-	if (pidfile_acquire(pidfile) < 0)
+	if (pidfile != NULL && pidfile_acquire(pidfile) < 0)
 		exit(1);
 
 	/* equivelent of doing a fflush after every \n */
@@ -166,7 +166,7 @@
 	sanitize_fds();
 
 	/* do some other misc startup stuff while we are here to save bytes */
-	if (pidfile_acquire(pidfile) < 0)
+	if (pidfile != NULL && pidfile_acquire(pidfile) < 0)
 		exit(1);
 
 	/* equivelent of doing a fflush after every \n */
--- busybox-1.00/networking/udhcp/pidfile.c~udhcppidfile2
+++ busybox-1.00/networking/udhcp/pidfile.c
@@ -141,7 +141,11 @@
 int pidfile_acquire(const char *pidfile)
 {
 	int fd, result;
-	if (!pidfile) return (-1);
+
+	if (pidfile == NULL) {
+		LOG(LOG_ERR, "pidfile_acquire: filename is NULL\n");
+		return (-1);
+	}
 
 	if ((fd = pidfile_open(pidfile)) < 0)
 		return (-1);
@@ -170,7 +174,11 @@
 int pidfile_reassign(const char *pidfile, int pid)
 {
 	int fd, result;
-	if (!pidfile) return (-1);
+
+	if (pidfile == NULL) {
+		LOG(LOG_ERR, "pidfile_reassign: filename is NULL\n");
+		return (-1);
+	}
 
 	if ((fd = pidfile_open(pidfile)) < 0)
 		return (-1);