Bug 842244 - Macro L_cuserid missing in /usr/include/stdio.h in F17
Summary: Macro L_cuserid missing in /usr/include/stdio.h in F17
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jeff Law
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-23 08:37 UTC by Joachim Backes
Modified: 2016-11-24 16:17 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-23 15:46:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Joachim Backes 2012-07-23 08:37:47 UTC
Description of problem:
The man page of getlogin(3) says that L_cuserid is  declared  in
<stdio.h>. But if I try to compile (gcc-4.7.0-5.fc17.x86_64) a little
source using L_cuserid

#include <unistd.h>
#include <stdio.h>
main () {
fprintf (stderr,"L_cuserid = %d",L_cuserid);
}


I get an error:

x.c: In function ‘main’:
x.c:4:34: error: ‘L_cuserid’ undeclared (first use in this function)
x.c:4:34: note: each undeclared identifier is reported only once for
each function it appears in

The source compiles correctly if I use -D_XOPEN_SOURCE or -D_GNU_SOURCE

Version-Release number of selected component (if applicable):
glibc-headers-2.15-51.fc17.x86_64

How reproducible:
always

Steps to Reproduce:
1.compile the above source
2.
3.
  
Actual results:
syntax error

Expected results:
compiles without any additional defines (such as the manpage says)

Additional info:

Installed on my box:

glibc-devel-2.15-51.fc17.x86_64
glibc-2.15-51.fc17.x86_64
glibc-2.15-51.fc17.i686
glibc-common-2.15-51.fc17.x86_64
glibc-headers-2.15-51.fc17.x86_64
glibc-devel-2.15-51.fc17.i686
gcc-java-4.7.0-5.fc17.x86_64
gcc-4.7.0-5.fc17.x86_64
gcc-c++-4.7.0-5.fc17.x86_64

Comment 1 Jeff Law 2012-07-23 15:46:51 UTC
The cuserid interfaces are documented as needing feature test macros in the man page:

  Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       getlogin_r(): _REENTRANT || _POSIX_C_SOURCE >= 199506L
       cuserid(): _XOPEN_SOURCE

ie, it is expected that you need to define _XOPEN_SOURCE to use cuserid/L_cuserid.


Note You need to log in before you can comment on or make changes to this bug.