summaryrefslogtreecommitdiff
path: root/pwd/getpw.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-06-30 17:16:08 +0000
committerUlrich Drepper <drepper@redhat.com>1999-06-30 17:16:08 +0000
commit0ea5db4f1f55e55942f6afd0e4e69ceb2163ed25 (patch)
treea3427369d6193a9618eb9a0c7078a0832210c282 /pwd/getpw.c
parent16848c985d9e4d6f8ca7a9c2c4ac711ef63835ec (diff)
downloadglibc-0ea5db4f1f55e55942f6afd0e4e69ceb2163ed25.tar.gz
Update.
1999-06-28 Andreas Jaeger <aj@arthur.rhein-neckar.de> * inet/rcmd.c (__icheckhost): Test for gethostbyname_r result correctly. 1999-06-25 Andreas Jaeger <aj@arthur.rhein-neckar.de> * manual/arith.texi (System V Number Conversion): Fix the description which confused pointer and value to pointer. Reported by Andries.Brouwer@cwi.nl. 1999-06-28 Andreas Jaeger <aj@arthur.rhein-neckar.de> * pwd/getpw.c (__getpw): Check for NULL result pointer. 1999-06-29 Andreas Jaeger <aj@arthur.rhein-neckar.de> * manual/users.texi (Lookup User): Document POSIX return semantics for getpwuid_r and getgrgid_r. * manual/socket.texi (Host Names): Document that the result pointer is null in case of error or host not found and fix a typo. Give a small example.
Diffstat (limited to 'pwd/getpw.c')
-rw-r--r--pwd/getpw.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pwd/getpw.c b/pwd/getpw.c
index e291769237..5973ef0eea 100644
--- a/pwd/getpw.c
+++ b/pwd/getpw.c
@@ -50,6 +50,9 @@ __getpw (uid, buf)
if (__getpwuid_r (uid, &resbuf, tmpbuf, buflen, &p) != 0)
return -1;
+ if (p == NULL)
+ return -1;
+
if (sprintf (buf, "%s:%s:%lu:%lu:%s:%s:%s", p->pw_name, p->pw_passwd,
(unsigned long int) p->pw_uid, (unsigned long int) p->pw_gid,
p->pw_gecos, p->pw_dir, p->pw_shell) < 0)