Hello Andrew,

On Mon, Oct 31, 2005 at 09:56:27PM +1000, Andrew Pollock wrote:
>
> > run_hook() and run_hookdir() looks okay for me, but the following change 
> > looks
> > wrong to me:
> > 
> > @@ -64,14 +67,15 @@
> >  # Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
> >  exit_with_hooks() {
> >      exit_status=$1
> > +    shift  # See run_hooks()
> >  
> >      # Source the documented exit-hook script, if it exists
> > 
> > because you are shifting away the number which makes the difference.
> > Will test this and let you know the results.
> 
> Yes, but $exit_status is purely saved for exiting with the correct exit code
> after running all the hooks, right? If the hooks are supposed to have access
> to the exit code as well, then I guess I can either not shift it off $*, or
> the hooks can access it via $exit_status.
> Actually, after I reread the bug report, you're probably right, I don't want
> to be discarding the original $1 before running the hooks, it's the crux of
> your original bug report...

Sorry, I send unified diff format without pointing that out - 
of course only the shift must go away.

In the attached unified diff I also deleted some superfluous "$@" arguments,
which are not present in the original dhclient-script and not needed, as
far as I can see.

With this changes everything works for me as expected.

Greetings
  Hermann

-- 
Netzwerkadministration/Zentrale Dienste, Interdiziplinaeres 
Zentrum fuer wissenschaftliches Rechnen der Universitaet Heidelberg
IWR; INF 368; 69120 Heidelberg; Tel: (06221)54-8236 Fax: -5224
Email: [EMAIL PROTECTED]
--- dhclient-script.test        2005-11-02 09:51:35.000000000 +0100
+++ dhclient-script     2005-11-02 09:56:00.000000000 +0100
@@ -67,7 +67,6 @@
 # Must be used on exit.   Invokes the local dhcp client exit hooks, if any.
 exit_with_hooks() {
     exit_status=$1
-    shift      # See run_hooks()
 
     # Source the documented exit-hook script, if it exists
     if ! run_hook /etc/dhcp3/dhclient-exit-hooks "$@"; then
@@ -115,8 +114,8 @@
 # The action starts here
 
 # Invoke the local dhcp client enter hooks, if they exist.
-run_hook /etc/dhcp3/dhclient-enter-hooks "$@"
-run_hookdir /etc/dhcp3/dhclient-enter-hooks.d "$@"
+run_hook /etc/dhcp3/dhclient-enter-hooks
+run_hookdir /etc/dhcp3/dhclient-enter-hooks.d
 
 # Execute the operation
 case "$reason" in
@@ -247,4 +246,4 @@
         ;;
 esac
 
-exit_with_hooks 0 "$@"
+exit_with_hooks 0

Reply via email to