126 lines
3.1 KiB
Plaintext
126 lines
3.1 KiB
Plaintext
--- bashline.c
|
|
+++ bashline.c 2011-11-11 13:22:00.119146416 +0000
|
|
@@ -2148,10 +2148,10 @@ bash_groupname_completion_function (text
|
|
if (gnamelen == 0 || (STREQN (gname, grent->gr_name, gnamelen)))
|
|
break;
|
|
}
|
|
+ endgrent ();
|
|
|
|
if (grent == 0)
|
|
{
|
|
- endgrent ();
|
|
return ((char *)NULL);
|
|
}
|
|
|
|
--- examples/loadables/finfo.c
|
|
+++ examples/loadables/finfo.c 2011-11-11 13:21:12.319218165 +0000
|
|
@@ -269,9 +269,11 @@ struct stat *st;
|
|
printmode((int) st->st_mode);
|
|
printf("Link count: %d\n", (int) st->st_nlink);
|
|
pw = getpwuid(st->st_uid);
|
|
+ endpwent();
|
|
owner = pw ? pw->pw_name : "unknown";
|
|
printf("Uid of owner: %d (%s)\n", (int) st->st_uid, owner);
|
|
gr = getgrgid(st->st_gid);
|
|
+ endgrent();
|
|
owner = gr ? gr->gr_name : "unknown";
|
|
printf("Gid of owner: %d (%s)\n", (int) st->st_gid, owner);
|
|
printf("Device type: %d\n", (int) st->st_rdev);
|
|
@@ -348,12 +350,14 @@ int flags;
|
|
printf("%o\n", getperm(st->st_mode) & pmask);
|
|
else if (flags & OPT_UID) {
|
|
pw = getpwuid(st->st_uid);
|
|
+ endpwent();
|
|
if (flags & OPT_ASCII)
|
|
printf("%s\n", pw ? pw->pw_name : "unknown");
|
|
else
|
|
printf("%d\n", st->st_uid);
|
|
} else if (flags & OPT_GID) {
|
|
gr = getgrgid(st->st_gid);
|
|
+ endgrent();
|
|
if (flags & OPT_ASCII)
|
|
printf("%s\n", gr ? gr->gr_name : "unknown");
|
|
else
|
|
--- examples/loadables/id.c
|
|
+++ examples/loadables/id.c 2011-11-11 13:19:36.515148229 +0000
|
|
@@ -42,6 +42,7 @@
|
|
|
|
#if !defined (HAVE_GETPW_DECLS)
|
|
extern struct passwd *getpwuid ();
|
|
+extern void endpwent ();
|
|
#endif
|
|
extern struct group *getgrgid ();
|
|
|
|
@@ -146,6 +147,7 @@ inituser (uname)
|
|
builtin_error ("%s: no such user", uname);
|
|
return -1;
|
|
}
|
|
+ endpwent ();
|
|
ruid = euid = pwd->pw_uid;
|
|
rgid = egid = pwd->pw_gid;
|
|
}
|
|
@@ -173,6 +175,7 @@ id_pruser (uid)
|
|
pwd = getpwuid (uid);
|
|
if (pwd == NULL)
|
|
r = 1;
|
|
+ endpwent ();
|
|
}
|
|
if (pwd)
|
|
printf ("%s", pwd->pw_name);
|
|
@@ -197,6 +200,7 @@ id_prgrp (gid)
|
|
grp = getgrgid (gid);
|
|
if (grp == NULL)
|
|
r = 1;
|
|
+ endgrent ();
|
|
}
|
|
|
|
if (grp)
|
|
@@ -307,6 +311,8 @@ id_prall (uname)
|
|
else
|
|
printf ("(%s)", grp->gr_name);
|
|
}
|
|
+ endpwent ();
|
|
+ endgrent ();
|
|
|
|
return r;
|
|
}
|
|
--- lib/tilde/shell.c
|
|
+++ lib/tilde/shell.c 2011-11-11 13:12:35.932960442 +0000
|
|
@@ -45,7 +45,12 @@
|
|
#include <pwd.h>
|
|
|
|
#if !defined (HAVE_GETPW_DECLS)
|
|
+# if defined (HAVE_GETPWUID)
|
|
extern struct passwd *getpwuid ();
|
|
+# endif
|
|
+# if defined (HAVE_GETPWENT)
|
|
+extern void endpwent ();
|
|
+# endif
|
|
#endif /* !HAVE_GETPW_DECLS */
|
|
|
|
char *
|
|
@@ -62,8 +67,13 @@ get_home_dir ()
|
|
struct passwd *entry;
|
|
|
|
home_dir = (char *)NULL;
|
|
+#if defined (HAVE_GETPWUID)
|
|
entry = getpwuid (getuid ());
|
|
if (entry)
|
|
home_dir = entry->pw_dir;
|
|
+#endif
|
|
+#if defined (HAVE_GETPWENT)
|
|
+ endpwent ();
|
|
+#endif
|
|
return (home_dir);
|
|
}
|
|
--- lib/tilde/tilde.c
|
|
+++ lib/tilde/tilde.c 2011-11-11 13:10:07.375646928 +0000
|
|
@@ -61,6 +61,7 @@ extern struct passwd *getpwuid PARAMS((u
|
|
# endif
|
|
# if defined (HAVE_GETPWNAM)
|
|
extern struct passwd *getpwnam PARAMS((const char *));
|
|
+extern void endpwent ();
|
|
# endif
|
|
#endif /* !HAVE_GETPW_DECLS */
|
|
|