Sanitizing env handling for children and using busbox for scripts. - nldev - NetLink DEVice manager; a lightweight netlink frontend for mdev.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 7b9e5ae8574e3964f83084d647be6d6b00c04761
(DIR) parent 72e47aa0fcc6a88984076cc7839c9e2ba15ff53f
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Fri, 18 May 2012 15:20:43 +0200
Sanitizing env handling for children and using busbox for scripts.
Diffstat:
nldev.c | 12 ++----------
nltrigger | 2 +-
run_nldev | 4 ++--
3 files changed, 5 insertions(+), 13 deletions(-)
---
(DIR) diff --git a/nldev.c b/nldev.c
@@ -231,16 +231,8 @@ main(int argc, char *argv[])
buf[sizeof(buf)-1] = '\0';
while (poll(&fds, 1, -1) > -1) {
- unsetenv("ACTION");
- unsetenv("DEVPATH");
- unsetenv("SUBSYSTEM");
- unsetenv("SEQNUM");
- unsetenv("MODALIAS");
- unsetenv("DEVNAME");
- unsetenv("DEVTYPE");
- unsetenv("MAJOR");
- unsetenv("MINOR");
- unsetenv("FIRMWARE");
+ clearenv();
+ setenv("PATH", "/sbin:/bin", 1);
iov.iov_base = &buf;
iov.iov_len = sizeof(buf);
(DIR) diff --git a/nltrigger b/nltrigger
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/busybox ash
if [ $# -eq 0 ];
tthen
(DIR) diff --git a/run_nldev b/run_nldev
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/busybox ash
if [ -e /proc/self/fd ];
tthen
- mkdir -p /dev/fd
+ rm -f /dev/fd 2>/dev/null
ln -s /proc/self/fd /dev/fd
fi