[uClibc-cvs] uClibc/libc/pwd_grp __getgrent_r.c, 1.1, 1.2 __getpwent_r.c, 1.4, 1.5 pwent.c, 1.13, 1.14
Erik Andersen
andersen at uclibc.org
Fri Oct 31 20:17:05 UTC 2003
Update of /var/cvs/uClibc/libc/pwd_grp
In directory winder:/tmp/cvs-serv10274
Modified Files:
__getgrent_r.c __getpwent_r.c pwent.c
Log Message:
getpwent(), getpwent_r(), and getgrent(), getgrent_r() would all
fail if you had not previously called setpwent() or setgrent()
respectively. Oops. My bad.
-Erik
Index: pwent.c
===================================================================
RCS file: /var/cvs/uClibc/libc/pwd_grp/pwent.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- pwent.c 10 Oct 2003 07:34:27 -0000 1.13
+++ pwent.c 31 Oct 2003 20:17:01 -0000 1.14
@@ -72,7 +72,8 @@
int ret=EINVAL;
LOCK;
*result = NULL;
- if (pw_fd != -1 && (ret=__getpwent_r(password, buff, buflen, pw_fd)) == 0) {
+
+ if ((ret=__getpwent_r(password, buff, buflen, pw_fd)) == 0) {
UNLOCK;
*result = password;
return 0;
Index: __getgrent_r.c
===================================================================
RCS file: /var/cvs/uClibc/libc/pwd_grp/__getgrent_r.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- __getgrent_r.c 10 Oct 2003 07:34:26 -0000 1.1
+++ __getgrent_r.c 31 Oct 2003 20:17:01 -0000 1.2
@@ -44,6 +44,9 @@
return ERANGE;
}
+ if (grp_fd==-1)
+ setgrent();
+
/* We use the restart label to handle malformatted lines */
restart:
/* Read the group line into the buffer for processing */
Index: __getpwent_r.c
===================================================================
RCS file: /var/cvs/uClibc/libc/pwd_grp/__getpwent_r.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- __getpwent_r.c 10 Oct 2003 07:34:26 -0000 1.4
+++ __getpwent_r.c 31 Oct 2003 20:17:01 -0000 1.5
@@ -47,6 +47,9 @@
return ERANGE;
}
+ if (pw_fd == -1)
+ setpwent();
+
/* We use the restart label to handle malformatted lines */
restart:
/* Read the passwd line into the buffer for processing */
More information about the uClibc-cvs
mailing list