Modify

Opened 12 years ago

Closed 12 years ago

#239 closed defect (fixed)

kill fails in functions.sh:do_ifup

Reported by: anonymous Owned by: developers
Priority: low Milestone: 0.9/rc6
Component: base system Version:
Keywords: Cc:

Description

Hi All,

While starting the wan interface on dhcp, a message pops up in the syslog like:
kill: 1: Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or
kill -l [exitstatus]

Tracing this down reveals that, while udhcpc is started and created a pidfile, it has failed to write the contents of the pidfile. This is done eventually, but the system is busy and udhcpc does not get enough cpu cycles before it is in order.

In /etc/functions.sh, there is a test like:

...
oldpid=$(cat $pidfile)
${DEBUG:-eval} "udhcpc $DHCP_ARGS"
pidof udhcpc | grep "$oldpid" >&- 2>&- && {
	sleep 1
	kill -9 $oldpid
}
...

However, with the pidfile empty, the kill will get executed and results in a failure.

This is solved easily by checking the contents of the pidfile, or rather the oldpid variable. Attached patch solves the problem.

--
Greetings Bertho

===================================================================
--- package/base-files/default/etc/functions.sh (revision 3032)
+++ package/base-files/default/etc/functions.sh (working copy)
@@ -70,7 +70,7 @@
                [ "$if_proto" = "pptp" ] && DHCP_ARGS="$DHCP_ARGS -n -q" || DHCP_ARGS="$DHCP_ARGS -R &"
                oldpid=$(cat $pidfile)
                ${DEBUG:-eval} "udhcpc $DHCP_ARGS"
-               pidof udhcpc | grep "$oldpid" >&- 2>&- && {
+               [ -n "${oldpid}" ] && pidof udhcpc | grep "$oldpid" >&- 2>&- && {
                        sleep 1
                        kill -9 $oldpid
                }

Attachments (0)

Change History (3)

comment:1 Changed 12 years ago by kaloz

  • Priority changed from normal to low

comment:2 Changed 12 years ago by kaloz

  • Milestone set to 1.0-rc6

comment:3 Changed 12 years ago by nico

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [3503]

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.