diff options
author | ache <ache@FreeBSD.org> | 1994-12-30 14:39:39 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1994-12-30 14:39:39 +0000 |
commit | 5bfcb77fd95f1a626bfca52c8f5f303f0dbdc2e2 (patch) | |
tree | eee5621af0a02dd71c665103cbf8a73c845a2d8d /gnu/lib/libreadline | |
parent | b4e68b2cf59b4eea196ba19626abb0ba05640adc (diff) | |
download | FreeBSD-src-5bfcb77fd95f1a626bfca52c8f5f303f0dbdc2e2.zip FreeBSD-src-5bfcb77fd95f1a626bfca52c8f5f303f0dbdc2e2.tar.gz |
Upgrade from new bash
Diffstat (limited to 'gnu/lib/libreadline')
-rw-r--r-- | gnu/lib/libreadline/rltty.c | 8 | ||||
-rw-r--r-- | gnu/lib/libreadline/tilde.c | 21 |
2 files changed, 12 insertions, 17 deletions
diff --git a/gnu/lib/libreadline/rltty.c b/gnu/lib/libreadline/rltty.c index a007beb..02c036d 100644 --- a/gnu/lib/libreadline/rltty.c +++ b/gnu/lib/libreadline/rltty.c @@ -22,15 +22,15 @@ 675 Mass Ave, Cambridge, MA 02139, USA. */ #define READLINE_LIBRARY +#if defined (HAVE_CONFIG_H) +# include "config.h" +#endif + #include <sys/types.h> #include <signal.h> #include <errno.h> #include <stdio.h> -#if defined (HAVE_CONFIG_H) -# include "config.h" -#endif - #if defined (HAVE_UNISTD_H) # include <unistd.h> #endif /* HAVE_UNISTD_H */ diff --git a/gnu/lib/libreadline/tilde.c b/gnu/lib/libreadline/tilde.c index 84c24b7..da75d95 100644 --- a/gnu/lib/libreadline/tilde.c +++ b/gnu/lib/libreadline/tilde.c @@ -250,22 +250,16 @@ tilde_expand_word (filename) } else { - char u_name[257]; - struct passwd *user_entry; char *username; - int i, c; + struct passwd *user_entry; + int i; - username = u_name; - for (i = 1; c = dirname[i]; i++) - { - if (c == '/') - break; - else - username[i - 1] = c; - } + username = xmalloc (strlen (dirname)); + for (i = 1; dirname[i] && dirname[i] != '/'; i++) + username[i - 1] = dirname[i]; username[i - 1] = '\0'; - if (!(user_entry = getpwnam (username))) + if ((user_entry = getpwnam (username)) == 0) { /* If the calling program has a special syntax for expanding tildes, and we couldn't find a standard @@ -298,7 +292,8 @@ tilde_expand_word (filename) free (dirname); dirname = temp_name; } - endpwent (); + endpwent (); + free (username); } } return (dirname); |