From patchwork Mon Nov 11 23:29:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 35812 Received: (qmail 69159 invoked by alias); 11 Nov 2019 23:29:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 69146 invoked by uid 89); 11 Nov 2019 23:29:10 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 11 Nov 2019 23:29:09 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 070CE20C08; Mon, 11 Nov 2019 18:29:07 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id E494C20362; Mon, 11 Nov 2019 18:29:06 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id C099C20AF6; Mon, 11 Nov 2019 18:29:06 -0500 (EST) X-Gerrit-PatchSet: 4 Date: Mon, 11 Nov 2019 18:29:05 -0500 From: "Sourceware to Gerrit sync (Code Review)" To: Christian Biesinger , Tom Tromey , gdb-patches@sourceware.org Auto-Submitted: auto-generated X-Gerrit-MessageType: newpatchset Subject: [pushed] Use getpwuid_r instead of getpwuid X-Gerrit-Change-Id: I587359267f8963ef1da6ba0223a1525807a721de X-Gerrit-Change-Number: 485 X-Gerrit-ChangeURL: X-Gerrit-Commit: 7b7b9424d3f94ba5595c4e164b67c0f621146dfe In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, tromey@sourceware.org, cbiesinger@google.com, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-76-gf8b6da0ab5 Message-Id: <20191111232906.C099C20AF6@gnutoolchain-gerrit.osci.io> The original change was created by Christian Biesinger. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/485 ...................................................................... Use getpwuid_r instead of getpwuid gdb/ChangeLog: 2019-11-11 Christian Biesinger * nat/linux-osdata.c (user_from_uid): Use getpwuid_r. Change-Id: I587359267f8963ef1da6ba0223a1525807a721de --- M gdb/ChangeLog M gdb/nat/linux-osdata.c 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index dd280ec..edd3e90 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2019-11-11 Christian Biesinger + + * nat/linux-osdata.c (user_from_uid): Use getpwuid_r. + 2019-11-10 Andrew Burgess * python/py-symbol.c (gdbpy_lookup_static_symbols): New diff --git a/gdb/nat/linux-osdata.c b/gdb/nat/linux-osdata.c index 84357e2..ca6acd3 100644 --- a/gdb/nat/linux-osdata.c +++ b/gdb/nat/linux-osdata.c @@ -205,7 +205,10 @@ static void user_from_uid (char *user, int maxlen, uid_t uid) { - struct passwd *pwentry = getpwuid (uid); + struct passwd *pwentry; + char buf[1024]; + struct passwd pwd; + getpwuid_r (uid, &pwd, buf, sizeof (buf), &pwentry); if (pwentry) {