How can I maintain a file descriptor's attributes across an execve()?
The problem I am having is that when I turn i/o buffering off using
setvbuf() in the child process, buffering ends up being restored in
the exec'd program. For example, look at the FILE* structures for the
child process before and after the execve():
Before execve():
{
_cnt = 0;
_ptr = 0xcef08 "";
_base = 0xcef08 "";
_bufsiz = 0;
_flag = 153;
_file = 0 '\000';
_smallbuf = 0 '\000';
After execve():Quote:}
{
_cnt = 0;
_ptr = 0x101ea " child stdin\n";
_base = 0x101e8 "1\n child stdin\n";
_bufsiz = 4096;
_flag = 9;
_file = 0 '\000';
_smallbuf = 0 '\000';
The man page for execve() says that open file descriptors are not effectedQuote:}
by the call. Obviously this is not quite true.
Any ideas on how I can maintain the unbuffered attribute?
Thanks,
Scott Stark