Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Jun 2020 16:56:15 +0000
From:      bugzilla-noreply@freebsd.org
To:        standards@FreeBSD.org
Subject:   [Bug 247102] getlogin_r(): Sort of a typo: int is actually a size_t
Message-ID:  <bug-247102-99-IzQWF7pXmu@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-247102-99@https.bugs.freebsd.org/bugzilla/>
References:  <bug-247102-99@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D247102

--- Comment #3 from Conrad Meyer <cem@freebsd.org> ---
Something like this:

--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -156,7 +156,6 @@ FBSD_1.0 {
        gethostname;
        getloadavg;
        getlogin;
-       getlogin_r;
        setnetgrent;
        getnetgrent;
        endnetgrent;
@@ -423,6 +422,7 @@ FBSD_1.5 {
 };

 FBSD_1.6 {
+       getlogin_r;
        memalign;
        sigandset;
        sigisemptyset;
--- a/lib/libc/gen/getlogin.c
+++ b/lib/libc/gen/getlogin.c
@@ -58,7 +58,7 @@ getlogin(void)
 }

 int
-getlogin_r(char *logname, int namelen)
+getlogin_r(char *logname, size_t namelen)
 {
        char tmpname[MAXLOGNAME];
        int     len;
@@ -75,3 +75,13 @@ getlogin_r(char *logname, int namelen)
        strlcpy(logname, tmpname, len);
        return (0);
 }
+
+/* FreeBSD 12 and earlier compat. */
+int
+__getlogin_r_fbsd12(char *logname, int namelen)
+{
+       if (namelen < 1)
+               return (ERANGE);
+       return (getlogin_r(logname, namelen));
+}
+__sym_compat(getlogin_r, __getlogin_r_fbsd12, FBSD_1.0);

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-247102-99-IzQWF7pXmu>