From patchwork Mon Nov 11 19:35:31 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: 35799 Received: (qmail 60751 invoked by alias); 11 Nov 2019 19:35:41 -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 60721 invoked by uid 89); 11 Nov 2019 19:35:40 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.3 required=5.0 tests=AWL, 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 19:35:37 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id 74416201E8; Mon, 11 Nov 2019 14:35:32 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id C019D20339; Mon, 11 Nov 2019 14:35:31 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 9DB8020AF6; Mon, 11 Nov 2019 14:35:31 -0500 (EST) X-Gerrit-PatchSet: 3 Date: Mon, 11 Nov 2019 14:35:31 -0500 From: "Christian Biesinger (Code Review)" To: Christian Biesinger , gdb-patches@sourceware.org Cc: Tom Tromey Auto-Submitted: auto-generated X-Gerrit-MessageType: newpatchset Subject: [review v3] Use getpwuid_r instead of getpwuid X-Gerrit-Change-Id: I587359267f8963ef1da6ba0223a1525807a721de X-Gerrit-Change-Number: 485 X-Gerrit-ChangeURL: X-Gerrit-Commit: 5269fbe162dfa9927c19972a4de680c692f63f59 In-Reply-To: References: Reply-To: cbiesinger@google.com, 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: <20191111193531.9DB8020AF6@gnutoolchain-gerrit.osci.io> 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/nat/linux-osdata.c 1 file changed, 4 insertions(+), 1 deletion(-) 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) {