Use getpwuid_r instead of getpwuid
authorChristian Biesinger <cbiesinger@google.com>
Sat, 2 Nov 2019 18:16:09 +0000 (13:16 -0500)
committerChristian Biesinger <cbiesinger@google.com>
Mon, 11 Nov 2019 23:28:22 +0000 (15:28 -0800)
gdb/ChangeLog:

2019-11-11  Christian Biesinger  <cbiesinger@google.com>

* nat/linux-osdata.c (user_from_uid): Use getpwuid_r.

Change-Id: I587359267f8963ef1da6ba0223a1525807a721de

gdb/ChangeLog
gdb/nat/linux-osdata.c

index dd280ec5cc48007340b07d71a929b5a14fad6c62..edd3e9013b26a2eda36a4a48c62c2b8af48aa938 100644 (file)
@@ -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
index 84357e29559ee1577f8573c3cfabdade074f42fc..ca6acd39eb115992484fce0fa939d254f647a445 100644 (file)
@@ -205,7 +205,10 @@ commandline_from_pid (PID_T pid)
 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)
     {