delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f |
From: | "Martin Str|mberg (ams AT ludd DOT luth DOT se) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Different dup2 behaviour between DOS/DJGPP and posix. |
Date: | Fri, 8 Apr 2016 08:46:49 +0000 (UTC) |
Organization: | Aioe.org NNTP Server |
Lines: | 26 |
Message-ID: | <ne7r5n$7uv$1@gioia.aioe.org> |
References: | <5706CAFA DOT 1060201 AT gmx DOT de> |
NNTP-Posting-Host: | WLZdEp4S2PR09rkVF8ILdg.user.gioia.aioe.org |
X-Complaints-To: | abuse AT aioe DOT org |
User-Agent: | tin/2.2.1-20140504 ("Tober an Righ") (UNIX) (Linux/3.16.0-4-amd64 (x86_64)) |
X-Notice: | Filtered by postfilter v. 0.8.2 |
Bytes: | 1727 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
"Juan Manuel Guerrero (juan DOT guerrero AT gmx DOT de) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com> wrote: > It depicts an autoconf check for dup2. If I compile this with DJGPP I get > the following output: > 14: result = 0 fd = 1 errno = No Error > 19: result = 8 fd = 0 errno = No Error > If I do the same on linux I get the following output: > 19: result = 0 fd = 1 errno = Success > 24: result = 0 fd = -1 errno = Bad file descriptor > The question is why DOS/DJGPP allows to close STDIN and reopen it with FD 0 > meanwhile posix seems not to allow this. Is this behaviour expected? > I have inspected the code of dup2 and the implementation seems OK. 1. DJGPP is compatible (and Linux is broken) according to the man page from SLED 11.3 (it says it's from 2008, so pretty old). 2. Remember that Linux is not 100% POSIX compliant, so it might be a bad idea to use that for POSIX checks. 3. In this case, I think Eli is right (and possibly your Linux). My Linux' man page is outdated. -- MartinS
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |