delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2016/04/08/03:11:00

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
autolearn=disabled version=3.3.2
Date: Fri, 08 Apr 2016 10:10:10 +0300
Message-Id: <831t6glgod.fsf@gnu.org>
From: "Eli Zaretskii (eliz AT gnu DOT org) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <5706E3D9.9070401@gmx.de> (djgpp@delorie.com)
Subject: Re: Different dup2 behaviour between DOS/DJGPP and posix.
References: <5706CAFA DOT 1060201 AT gmx DOT de> <5706E3D9 DOT 9070401 AT gmx DOT de>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Fri, 08 Apr 2016 00:48:57 +0200
> From: "Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
> 
> OK I think I have got it.  It is a bug in the DJGPP implementation of dup2.
> According to http://pubs.opengroup.org/onlinepubs/009695399/functions/dup.html
> The dup2() function shall fail if:
> 
> [EBADF]
>      The fildes argument is not a valid open file descriptor or the argument fildes2 is negative or greater than or equal to {OPEN_MAX}.
> 
> 
> The current implementation checks first if fd == newfd and if this is the case
> it returns inmediatly with newfd.  Here some fix will be required because no one
> of the 3 conditions are checked.  May be these error conditions were not in effect
> in those days when dup2 was implemented.

Yes, Posix has changed in this regard, AFAIR.

- Raw text -


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