Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Sourceware to Gerrit sync (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Christian Biesinger <cbiesinger@google.com>,
	Tom Tromey <tromey@sourceware.org>,
	gdb-patches@sourceware.org
Subject: [pushed] Use getpwuid_r instead of getpwuid
Date: Mon, 11 Nov 2019 23:29:00 -0000	[thread overview]
Message-ID: <20191111232906.C099C20AF6@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1572720018000.I587359267f8963ef1da6ba0223a1525807a721de@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  <cbiesinger@google.com>

	* 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  <cbiesinger@google.com>
+
+	* nat/linux-osdata.c (user_from_uid): Use getpwuid_r.
+
 2019-11-10  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* 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)
     {

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I587359267f8963ef1da6ba0223a1525807a721de
Gerrit-Change-Number: 485
Gerrit-PatchSet: 4
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset


  parent reply	other threads:[~2019-11-11 23:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-02 18:40 [review] Use getpwuid_r instead of getpwuid when available Christian Biesinger (Code Review)
2019-11-11 14:57 ` [review v2] " Tom Tromey (Code Review)
2019-11-11 19:35 ` [review v3] Use getpwuid_r instead of getpwuid Christian Biesinger (Code Review)
2019-11-11 19:36 ` Christian Biesinger (Code Review)
2019-11-11 23:25 ` Tom Tromey (Code Review)
2019-11-11 23:29 ` Sourceware to Gerrit sync (Code Review) [this message]
2019-11-11 23:29 ` [pushed] " Sourceware to Gerrit sync (Code Review)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191111232906.C099C20AF6@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=noreply@gnutoolchain-gerrit.osci.io \
    --cc=tromey@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox