Mail Archives: cygwin-developers/1998/11/14/07:17:02
Earnie Boyd wrote:
>
> ---Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de> wrote:
> <snip>
> > ...
> > close(0);
> > (void) dup(foo_fd);
> > ...
> >
>
> It appears that the coder is assuming that dup will use the first
> available file descriptor. This may not be true in all cases.
> [...]
X/Open Portability Guide, XSI System Interfaces (Quotation):
[...]
fid = dup(fildes);
is equivalent to
fid = fcntl(fildes, F_DUPFD, 0);
[...]
F_DUPFD Return a new file descriptor which is the lowest numbered
available (i.e., not already open) file descriptor greater
than or equal to the third argument [...]
Corinna
- Raw text -