This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Declare cuserid in unistd.h for UNIX98 and before (bug 20043)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Zack Weinberg <zackw at panix dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 4 May 2016 16:14:18 +0000
- Subject: Re: Declare cuserid in unistd.h for UNIX98 and before (bug 20043)
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 20 dot 1605041548150 dot 15301 at digraph dot polyomino dot org dot uk> <CAKCAbMjg8XUOz+2We6S9tn_fQk-swQPp_m70q2a+E_ZpkzMCqQ at mail dot gmail dot com>
On Wed, 4 May 2016, Zack Weinberg wrote:
> On Wed, May 4, 2016 at 11:48 AM, Joseph Myers <joseph@codesourcery.com> wrote:
> >
> > -/* The Single Unix specification demands this prototype to be here.
> > - It is also found in <stdio.h>. */
> > +/* The Single Unix specification demands these prototype to be here.
> > + They are also found in <stdio.h>. */
>
> Since you're touching this comment anyway, would you mind fixing the
> grammar and clarifying which version(s) of SUS are meant? I would
> suggest something along the lines of
>
> /* Prior to Issue 6, the Single Unix specification required these prototypes
> to appear in this header. They are also found in <stdio.h>. */
>
> only with the correct version information.
I think that's correct (with capital S on Specification); SUSv2 = Issue 5.
Declare cuserid in unistd.h for UNIX98 and before (bug 20043).
For UNIX98 and older X/Open standards, unistd.h should have a
declaration of the legacy cuserid function, but such a declaration is
missing. This patch adds that missing declaration.
Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).
2016-05-04 Joseph Myers <joseph@codesourcery.com>
[BZ #20043]
* posix/unistd.h [__USE_XOPEN && !__USE_XOPEN2K] (cuserid): New
prototype.
diff --git a/posix/unistd.h b/posix/unistd.h
index 405638c..4722f7f 100644
--- a/posix/unistd.h
+++ b/posix/unistd.h
@@ -1138,11 +1138,15 @@ extern void swab (const void *__restrict __from, void *__restrict __to,
#endif
-/* The Single Unix specification demands this prototype to be here.
- It is also found in <stdio.h>. */
+/* Prior to Issue 6, the Single Unix Specification required these
+ prototypes to appear in this header. They are also found in
+ <stdio.h>. */
#if defined __USE_XOPEN && !defined __USE_XOPEN2K
/* Return the name of the controlling terminal. */
extern char *ctermid (char *__s) __THROW;
+
+/* Return the name of the current user. */
+extern char *cuserid (char *__s);
#endif
--
Joseph S. Myers
joseph@codesourcery.com