commit 7b9e5ae8574e3964f83084d647be6d6b00c04761
parent 72e47aa0fcc6a88984076cc7839c9e2ba15ff53f
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:
3 files changed, 5 insertions(+), 13 deletions(-)
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);
diff --git a/nltrigger b/nltrigger
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/busybox ash
if [ $# -eq 0 ];
then
diff --git a/run_nldev b/run_nldev
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/busybox ash
if [ -e /proc/self/fd ];
then
- mkdir -p /dev/fd
+ rm -f /dev/fd 2>/dev/null
ln -s /proc/self/fd /dev/fd
fi