[COMMITTED] NaCl: Fix glob.c build after getlogin_r -> __getlogin_r.
Commit Message
2015-06-24 Roland McGrath <roland@hack.frob.com>
* sysdeps/nacl/glob.c (getlogin_r): Macro renamed to ...
(__getlogin_r): ... this.
Comments
On 06/25/2015 12:30 AM, Roland McGrath wrote:
> -#include <unistd.h> /* Declares getlogin_r. */
> +#include <unistd.h> /* Declares __getlogin_r. */
The change itself is good, though I wonder why the include is needed at all.
Would you help me understand ?
Best regards,
Tolga Dalman
On 29 Jun 2015 22:38, Tolga Dalman wrote:
> On 06/25/2015 12:30 AM, Roland McGrath wrote:
> > -#include <unistd.h> /* Declares getlogin_r. */
> > +#include <unistd.h> /* Declares __getlogin_r. */
>
> The change itself is good, though I wonder why the include is needed at all.
> Would you help me understand ?
because this file does:
#define __getlogin_r(name, len) (ENOSYS)
#include <sysdeps/wordsize-64/glob.c>
if the later glob.c files include unistd.h, then the preprocessor will produce
invalid code. the prototype will go from something like:
extern int __getlogin_r (char *__name, size_t __name_len) __nonnull ((1));
to:
extern int (ENOSYS) __nonnull ((1));
note: i didn't load up the exact source to see what line(s) would fail, but if
you're interested, you should be able to reproduce :)
-mike
@@ -16,11 +16,11 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <unistd.h> /* Declares getlogin_r. */
+#include <unistd.h> /* Declares __getlogin_r. */
/* We do not have getlogin_r in the library at all for NaCl.
Define it away so the glob code does not try to use it. */
-#define getlogin_r(name, len) (ENOSYS)
+#define __getlogin_r(name, len) (ENOSYS)
/* Fetch the version that defines glob64 as an alias. */
#include <sysdeps/wordsize-64/glob.c>