rfkilld

An rfkill daemon, which runs scripts according to rfkill events.
git clone git://r-36.net/rfkilld
Log | Files | Refs | LICENSE

commit 3bd645cd25ec87fbcdbc1e98c39dc9b8eccb5417
parent 398d2905b1b9bef02c7b11c687a408036da2c212
Author: Christoph Lohmann <20h@r-36.net>
Date:   Mon, 21 Mar 2011 10:16:45 +0100

Strncpy is a disgrace.

Diffstat:
rfkilld.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/rfkilld.c b/rfkilld.c @@ -47,8 +47,10 @@ runifexecutable(char *file, char *oname, char *ostate) char cmd[512], name[64], state[16]; int pid; - strncpy(name, oname, sizeof(name)); - strncpy(state, ostate, sizeof(state)); + strncpy(name, oname, sizeof(name)-1); + name[sizeof(name)-1] = '\0'; + strncpy(state, ostate, sizeof(state)-1); + state[sizeof(state)-1] = '\0'; snprintf(cmd, sizeof(cmd), "%s/%s.sh", etcdir, file); if (!access(cmd, X_OK)) {