it seems not get rid off the 0, 1, 2 file descriptors.
2007/4/23, Rik van Riel <riel@xxxxxxxxxxx
>:
rwen2012 wrote:
> HI, all
>
> it seems sys_execve() do not close the file descriptors 0, 1, 2 by
> default.
This is necessary, otherwise many shell commands would not work:
$ cat /path/to/backup/etc/passwd > /etc/passwd
$ bzcat /path/to/patch.bz2 | patch -p1
> But I can find where the kernel do that.
> can anyone tell me where is it in the source code?
From a 1 minute look at fs/exec.c (waiting for a compile), I
suspect you want flush_old_files().
--
Politics is the struggle between those who want to make their country
the best in the world, and those who believe it already is. Each group
calls the other unpatriotic.