[COMMITTED] NaCl: Fix glob.c build after getlogin_r -> __getlogin_r.
diff mbox

Message ID 20150624223049.02D0A2C3B00@topped-with-meat.com
State New
Headers show

Commit Message

Roland McGrath June 24, 2015, 10:30 p.m. UTC
2015-06-24  Roland McGrath  <roland@hack.frob.com>

	* sysdeps/nacl/glob.c (getlogin_r): Macro renamed to ...
	(__getlogin_r): ... this.

Comments

Tolga Dalman June 29, 2015, 8:38 p.m. UTC | #1
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
Mike Frysinger July 6, 2015, 9:51 a.m. UTC | #2
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

Patch
diff mbox

diff --git a/sysdeps/nacl/glob.c b/sysdeps/nacl/glob.c
index 36d62e8..eda6e9e 100644
--- a/sysdeps/nacl/glob.c
+++ b/sysdeps/nacl/glob.c
@@ -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>