[git commit master] ifdown: use /var/run/udhcpc.%iface%.pid only if it exists

Denys Vlasenko vda.linux at googlemail.com
Sun May 2 18:30:28 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=78abf88dcc5d39ef3a36477300ed00a730ce6daa
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/ifupdown.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index bf88b1c..2f3dd1d 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -573,8 +573,10 @@ static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
 static int FAST_FUNC dhcp_down(struct interface_defn_t *ifd, execfn *exec)
 {
 	int result;
-	result = execute("kill "
-	               "`cat /var/run/udhcpc.%iface%.pid` 2>/dev/null", ifd, exec);
+	result = execute(
+		"test -f /var/run/udhcpc.%iface%.pid && "
+		"kill `cat /var/run/udhcpc.%iface%.pid` 2>/dev/null",
+		ifd, exec);
 	/* Also bring the hardware interface down since
 	   killing the dhcp client alone doesn't do it.
 	   This enables consecutive ifup->ifdown->ifup */
-- 
1.6.3.3



More information about the busybox-cvs mailing list