commit 45dea6be7bad008421ab4025186cef82f3b780b3
parent 5f7acdb4b13e589123a49eaf6de02baab18abc83
Author: Christoph Lohmann <20h@r-36.net>
Date:   Thu,  3 May 2012 16:18:36 +0200
Correcting the calling convention and the manpage.
Diffstat:
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/rfkilld.8 b/rfkilld.8
@@ -21,15 +21,17 @@
 .Nm
 is a daemon to watch rfkill events. The daemon will call
 the appropriate scripts in etcdir/*.sh when an event
-appears. The first argument to that script will be the state
-the rfkill switch changed to.
+appears. For example an event for "wwan", "phy0" and the
+state "1" will try to call "$etcdir/wwan.sh 1 phy0" and
+"$etcdir/phy0.sh 1 wwan". Use rfkill(1) to find out about
+the values your system might produce.
 .Ed
 . 
 .Sh OPTIONS
 .Nm
 options and default settings.
 .Pp
-.Bl -tag -width ".Fl test Ao Ar string Ac"
+.Bl -tag -width ".Fl string"
 .
 .It Fl b
 Run in background.
@@ -48,8 +50,11 @@ Show usage.
 .It Fl l
 Turn on logging.
 .
+.Sh SEE ALSO
+rfkill(1)
+.
 .Sh AUTHORS
-See LICENSE file for authors in the distribution.
+See the LICENSE file for the authors of this software.
 .
 .Sh LICENSE
 .Nm
diff --git a/rfkilld.c b/rfkilld.c
@@ -12,6 +12,7 @@
 #include <stdarg.h>
 #include <syslog.h>
 #include <signal.h>
+#include <libgen.h>
 #include <errno.h>
 #include <strings.h>
 #include <sys/wait.h>
@@ -108,8 +109,10 @@ runifexecutable(char *file, char *oname, char *ostate)
 				dup2(fd, 2);
 				if (fd > 2)
 					close(fd);
-				if(execl(cmd, name, state, NULL) < 0)
+				if(execl(cmd, basename(name),
+						state, name, NULL) < 0) {
 					edie("execl");
+				}
 			}
 			exit(0);
 		}