summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-06-29 08:53:29 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-06-29 08:53:29 +0000
commitf21d9765a64fc97cf269727b7762fd1d277fedec (patch)
tree2588ae31611df1d107929a5c1ce12c34a9df7ba2
parent4b2d32e1fe19c4b84d925bc1d6bb2bd0e39cb156 (diff)
Restore signals for dev-up script
-rw-r--r--pand/main.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/pand/main.c b/pand/main.c
index 9dfa18a1..4afc095f 100644
--- a/pand/main.c
+++ b/pand/main.c
@@ -89,9 +89,10 @@ enum {
KILL
} modes;
-static void run_devup(char *dev, char *dst)
+static void run_devup(char *dev, char *dst, int sk, int nsk)
{
char *argv[4], prog[40];
+ struct sigaction sa;
sprintf(prog, "%s/%s", PAND_CONFIG_DIR, PAND_DEVUP_CMD);
@@ -101,6 +102,17 @@ static void run_devup(char *dev, char *dst)
if (fork())
return;
+ if (sk >= 0)
+ close(sk);
+
+ if (nsk >= 0)
+ close(nsk);
+
+ memset(&sa, 0, sizeof(sa));
+ sa.sa_handler = SIG_DFL;
+ sigaction(SIGCHLD, &sa, NULL);
+ sigaction(SIGPIPE, &sa, NULL);
+
argv[0] = prog;
argv[1] = dev;
argv[2] = dst;
@@ -190,7 +202,7 @@ static int do_listen(void)
syslog(LOG_INFO, "New connection from %s %s", str, netdev);
- run_devup(netdev, str);
+ run_devup(netdev, str, sk, nsk);
} else {
syslog(LOG_ERR, "Connection failed. %s(%d)",
strerror(errno), errno);
@@ -281,7 +293,7 @@ static int create_connection(char *dst, bdaddr_t *bdaddr)
syslog(LOG_INFO, "%s connected", netdev);
- run_devup(netdev, dst);
+ run_devup(netdev, dst, sk, -1);
if (persist) {
w4_hup(sk);