From owner-svn-src-all@freebsd.org Sun Sep 13 01:44:33 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 468153E8A8C; Sun, 13 Sep 2020 01:44:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Bpsjs14pdz4mM4; Sun, 13 Sep 2020 01:44:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 089331E56E; Sun, 13 Sep 2020 01:44:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 08D1iWAX018549; Sun, 13 Sep 2020 01:44:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 08D1iWxn018545; Sun, 13 Sep 2020 01:44:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202009130144.08D1iWxn018545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 13 Sep 2020 01:44:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r365682 - in stable/12: include lib/libc/gen lib/libc/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: include lib/libc/gen lib/libc/sys X-SVN-Commit-Revision: 365682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2020 01:44:33 -0000 Author: kevans Date: Sun Sep 13 01:44:31 2020 New Revision: 365682 URL: https://svnweb.freebsd.org/changeset/base/365682 Log: MFC r365506 getlogin_r: fix the type of len getlogin_r is specified by POSIX to to take a size_t len, not int. Fix our version to do the same, bump the symbol version due to ABI change and provide compat. This was reported to break compilation of Ruby 2.8. Some discussion about the necessity of the ABI compat did take place in the review. While many 64-bit platforms would likely be passing it in a 64-bit register and zero-extended and thus, not notice ABI breakage, some do sign-extend (e.g. mips). PR: 247102 Modified: stable/12/include/unistd.h stable/12/lib/libc/gen/Symbol.map stable/12/lib/libc/gen/getlogin.c stable/12/lib/libc/sys/getlogin.2 Directory Properties: stable/12/ (props changed) Modified: stable/12/include/unistd.h ============================================================================== --- stable/12/include/unistd.h Sun Sep 13 01:09:22 2020 (r365681) +++ stable/12/include/unistd.h Sun Sep 13 01:44:31 2020 (r365682) @@ -399,7 +399,7 @@ int ftruncate(int, off_t); #endif #if __POSIX_VISIBLE >= 199506 -int getlogin_r(char *, int); +int getlogin_r(char *, size_t); #endif /* 1003.1-2001 */ Modified: stable/12/lib/libc/gen/Symbol.map ============================================================================== --- stable/12/lib/libc/gen/Symbol.map Sun Sep 13 01:09:22 2020 (r365681) +++ stable/12/lib/libc/gen/Symbol.map Sun Sep 13 01:44:31 2020 (r365682) @@ -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 { __sysctlbyname; + getlogin_r; memalign; scandir_b; sigandset; Modified: stable/12/lib/libc/gen/getlogin.c ============================================================================== --- stable/12/lib/libc/gen/getlogin.c Sun Sep 13 01:09:22 2020 (r365681) +++ stable/12/lib/libc/gen/getlogin.c Sun Sep 13 01:44:31 2020 (r365682) @@ -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); Modified: stable/12/lib/libc/sys/getlogin.2 ============================================================================== --- stable/12/lib/libc/sys/getlogin.2 Sun Sep 13 01:09:22 2020 (r365681) +++ stable/12/lib/libc/sys/getlogin.2 Sun Sep 13 01:44:31 2020 (r365682) @@ -28,7 +28,7 @@ .\" @(#)getlogin.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd June 9, 1993 +.Dd September 9, 2020 .Dt GETLOGIN 2 .Os .Sh NAME @@ -44,7 +44,7 @@ .Fn getlogin void .In sys/param.h .Ft int -.Fn getlogin_r "char *name" "int len" +.Fn getlogin_r "char *name" "size_t len" .Ft int .Fn setlogin "const char *name" .Sh DESCRIPTION