Re: dup2() Problem
Re: dup2() Problem
- Subject: Re: dup2() Problem
- From: "Justin C. Walker" <email@hidden>
- Date: Thu, 5 Jul 2007 18:57:27 -0700
On Jul 5, 2007, at 18:10 , Norm Green wrote:
Hi,
I'm having a problem on Darwin i386 using dup2() in a child
process. This is after a fork() call but before execve() call.
After the fork I do:
int logfd = open(logName, O_WRONLY|O_APPEND|O_CREAT, 0644);
dup2(logfd, STDOUT_FILENO);
The open() call succeeds but the dup2() call always fails with
errno=9, which suggests one of the args is not an open fd. I'm
sure I'm not closing either in my code.
I think errno == 9 suggests that one of the values is bad, not that
one of the file descriptors is closed. The man page implies that
'newd' may be open or closed before the dup2() call. Have you really
checked the value of each argument?
Justin
--
Justin C. Walker, Curmudgeon-At-Large
Institute for the Enhancement of the Director's Income
--------
When LuteFisk is outlawed,
Only outlaws will have LuteFisk
--------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden