delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/11/14/07:17:02

From: corinna DOT vinschen AT cityweb DOT de (Corinna Vinschen)
Subject: Re: Error in dup???
14 Nov 1998 07:17:02 -0800 :
Message-ID: <364D9ED0.6C6A9FEC.cygnus.cygwin32.developers@cityweb.de>
References: <19981114041054 DOT 582 DOT rocketmail AT send1b DOT yahoomail DOT com>
Mime-Version: 1.0
To: earnie_boyd AT yahoo DOT com, cygwin32-developers AT cygnus DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019