From owner-svn-src-stable@freebsd.org Wed Feb 28 02:39:38 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C27C4F415B6; Wed, 28 Feb 2018 02:39:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7489D7E8B6; Wed, 28 Feb 2018 02:39:38 +0000 (UTC) (envelope-from pfg@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 6F8FC136D8; Wed, 28 Feb 2018 02:39:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1S2dc2Z087363; Wed, 28 Feb 2018 02:39:38 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1S2dcLD087362; Wed, 28 Feb 2018 02:39:38 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201802280239.w1S2dcLD087362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Wed, 28 Feb 2018 02:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r330095 - stable/10/lib/libc/gen X-SVN-Group: stable-10 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/10/lib/libc/gen X-SVN-Commit-Revision: 330095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Feb 2018 02:39:38 -0000 Author: pfg Date: Wed Feb 28 02:39:38 2018 New Revision: 330095 URL: https://svnweb.freebsd.org/changeset/base/330095 Log: MFC r329846: getpeereid(3): Fix behavior on failure to match documentation. According to the getpeereid(3) documentation, on failure the value -1 is returned and the global variable errno is set to indicate the error. We were returning the error instead. Obtained from: Apple's Libc-1244.30.3 Modified: stable/10/lib/libc/gen/getpeereid.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/getpeereid.c ============================================================================== --- stable/10/lib/libc/gen/getpeereid.c Wed Feb 28 02:37:59 2018 (r330094) +++ stable/10/lib/libc/gen/getpeereid.c Wed Feb 28 02:39:38 2018 (r330095) @@ -46,8 +46,10 @@ getpeereid(int s, uid_t *euid, gid_t *egid) error = getsockopt(s, 0, LOCAL_PEERCRED, &xuc, &xuclen); if (error != 0) return (error); - if (xuc.cr_version != XUCRED_VERSION) - return (EINVAL); + if (xuc.cr_version != XUCRED_VERSION) { + errno = EINVAL; + return (-1); + } *euid = xuc.cr_uid; *egid = xuc.cr_gid; return (0);