From: newsham AT lava DOT net (Tim Newsham) Subject: cygwin.dll/setpwent bug 29 Oct 1997 20:50:33 -0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit To: gnu-win32 AT cygnus DOT com, noer AT cygnus DOT com Hi, Looks like there is a bug in setpwent/endpwent functions in winsup/passwd.cc. The following program should dump all the usernames in /etc/passwd. Instead it dumps only the last username. This is because setpwent sets the pointer to the last line in the file, not the first, and getpwent moves forward in this file. The fix is: ----- start diff ---- *** passwd.cc.orig Wed Oct 29 12:20:35 1997 --- passwd.cc Wed Oct 29 12:20:51 1997 *************** *** 207,220 **** void setpwent (void) { ! i = curr_lines - 1; } extern "C" void endpwent (void) { ! i = 0; } extern "C" --- 207,220 ---- void setpwent (void) { ! i = 0; } extern "C" void endpwent (void) { ! i = curr_lines; } extern "C" ----- end diff ---- the test program is: ----- start dumppw.c ---- #include int main() { struct passwd *p; setpwent(); while((p = getpwent())) { printf("%s %d\n", p->pw_name, p->pw_passwd); } printf("done\n"); return 0; } - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".