Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-3]: src/lib/libedit Pull up revision 1.50 (requested by lukem in ...



details:   https://anonhg.NetBSD.org/src/rev/b98e6046a611
branches:  netbsd-3
changeset: 576593:b98e6046a611
user:      tron <tron%NetBSD.org@localhost>
date:      Tue Jul 12 11:33:40 2005 +0000

description:
Pull up revision 1.50 (requested by lukem in ticket #542):
use getpwent_r

diffstat:

 lib/libedit/readline.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r d0b0a99bc2a4 -r b98e6046a611 lib/libedit/readline.c
--- a/lib/libedit/readline.c    Mon Jul 11 21:38:58 2005 +0000
+++ b/lib/libedit/readline.c    Tue Jul 12 11:33:40 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: readline.c,v 1.49.2.2 2005/05/28 14:03:25 tron Exp $   */
+/*     $NetBSD: readline.c,v 1.49.2.3 2005/07/12 11:33:40 tron Exp $   */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.49.2.2 2005/05/28 14:03:25 tron Exp $");
+__RCSID("$NetBSD: readline.c,v 1.49.2.3 2005/07/12 11:33:40 tron Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <sys/types.h>
@@ -1550,7 +1550,8 @@
 char *
 username_completion_function(const char *text, int state)
 {
-       struct passwd *pwd;
+       struct passwd *pwd, pwres;
+       char pwbuf[1024];
 
        if (text[0] == '\0')
                return (NULL);
@@ -1561,7 +1562,8 @@
        if (state == 0)
                setpwent();
 
-       while ((pwd = getpwent()) && text[0] == pwd->pw_name[0]
+       while (getpwent_r(&pwres, pwbuf, sizeof(pwbuf), &pwd) == 0
+           && text[0] == pwd->pw_name[0]
            && strcmp(text, pwd->pw_name) == 0);
 
        if (pwd == NULL) {



Home | Main Index | Thread Index | Old Index