diff options
| author | christos <christos@NetBSD.org> | 2016-01-04 03:00:24 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2016-01-04 03:00:24 +0000 |
| commit | 4db07438285aac6fc5ea244646eaf1ac889ee665 (patch) | |
| tree | a6ae88fc711463e1b25422e677e937098c777d98 /sys/dev/raidframe | |
| parent | 8d83cc48d4f352b5ed783bc4fe6e6ef466601dfa (diff) | |
Don't leak redirected rescriptors to exec'ed processes. This is what ksh
does, but bash does not. For example:
$ cat test1
#!/bin/sh
exec 6> out
echo "test" >&6
sh ./test2
exec 6>&-
$ cat test2
echo "test2" >&6
$ ./test1
./test2: 6: Bad file descriptor
This fixes by side effect the problem of the rc system leaking file descriptors
7 and 8 to all starting daemons:
$ fstat -p 1359
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
root powerd 1359 wd / 2 drwxr-xr-x 512 r
root powerd 1359 0 / 63029 crw-rw-rw- null rw
root powerd 1359 1 / 63029 crw-rw-rw- null rw
root powerd 1359 2 / 63029 crw-rw-rw- null rw
root powerd 1359 3* kqueue pending 0
root powerd 1359 4 / 64463 crw-r----- power r
root powerd 1359 7 flags 0x80034<ISTTY,MPSAFE,LOCKSWORK,CLEAN>
root powerd 1359 8 flags 0x80034<ISTTY,MPSAFE,LOCKSWORK,CLEAN>
root powerd 1359 9* pipe 0xfffffe815d7bfdc0 -> 0x0 w
Note fd=7,8 pointing to the revoked pty from the parent rc process.
Diffstat (limited to 'sys/dev/raidframe')
0 files changed, 0 insertions, 0 deletions
