Bug 842244 - Macro L_cuserid missing in /usr/include/stdio.h in F17
Macro L_cuserid missing in /usr/include/stdio.h in F17
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
17
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jeff Law
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-23 04:37 EDT by Joachim Backes
Modified: 2016-11-24 11:17 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-07-23 11:46:51 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Joachim Backes 2012-07-23 04:37:47 EDT
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 11:46:51 EDT
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.