Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130314171752.GB19010@port70.net>
Date: Thu, 14 Mar 2013 18:17:52 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: question: hard-coded file descriptors in
 stdin/stdout/stderr

* Zvi Gilboa <zg7s@...rvices.virginia.edu> [2013-03-14 12:18:53 -0400]:
> I just noticed that the file descriptors in stdin.c, stdout.c, and
> stderr.c do not use the #defines from <unistd.h> (namely
> STDIN_FILENO, STDOUT_FILENO, and STDERR_FILENO), but are rather
> hard-coded (as 0, 1, and 2 respectively).  I was therefore wondering

these numbers are fixed on posix (and linux and all historical unices)

the macro definitions are there for conformance reasons

it's like using 0 instead of NULL or -1U instead of UINT_MAX


> this would normally not be an issue, however there are still some
> systems out there with standard file descriptor numbers which are
> different...

which ones?

> On that same note: wouldn't it make sense to slightly modify
> unistd.h so that it first checks whether STDIN_FILENO, etc. have

i dont think it makes sense for a linux libc
to have these numbers configurable

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.