Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 10 Oct 2017 22:09:49 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] stdio: implement fopencookie(3)

On Tue, Oct 10, 2017 at 06:58:30PM -0400, Morten Welinder wrote:
> > Also note that while standard functions in POSIX can additionally be
> > defined as function-like macros, they can't be object-like macros, so
> > (*read), etc. are safe due to the parentheses.
> 
> I'm not sure that's true.  Solaris defines (or used to, at least),
> say, "open" to "open64" under the right conditions.  With that, actual
> field names in the structure ends up being dependent on #include
> order.  Quite a mess and worse for "stat" since "struct stat" gets
> renamed in addition to the function.
> 
> "#define open my_table.my_open" would be fun too.  I haven't seen that
> in the wild, though.

If so that's just a bug in Solaris's headers, for two reasons:

(1) It's an object-like macro not a function-like macro.

(2) It doesn't work if the application does #undef open, which is
explicitly permitted.

Rich

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.