summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/fgetpwent.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/pwd_grp/fgetpwent.c')
-rw-r--r--libc/pwd_grp/fgetpwent.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/libc/pwd_grp/fgetpwent.c b/libc/pwd_grp/fgetpwent.c
index ae43cdad8..e025cf6cc 100644
--- a/libc/pwd_grp/fgetpwent.c
+++ b/libc/pwd_grp/fgetpwent.c
@@ -20,28 +20,24 @@
#include <errno.h>
#include <stdio.h>
-#include <pwd.h>
#include "config.h"
-#define PWD_BUFFER_SIZE 256
-
-/* file descriptor for the password file currently open */
-static char line_buff[PWD_BUFFER_SIZE];
-static struct passwd pwd;
-
int fgetpwent_r (FILE *file, struct passwd *password,
char *buff, size_t buflen, struct passwd **crap)
{
- if (file == NULL) {
- __set_errno(EINTR);
- return -1;
- }
- return(__getpwent_r(password, buff, buflen, fileno(file)));
+ if (file == NULL) {
+ __set_errno(EINTR);
+ return -1;
+ }
+ return(__getpwent_r(password, buff, buflen, fileno(file)));
}
struct passwd *fgetpwent(FILE * file)
{
- if (fgetpwent_r(file, &pwd, line_buff, PWD_BUFFER_SIZE, NULL) != -1) {
+ static char line_buff[PWD_BUFFER_SIZE];
+ static struct passwd pwd;
+
+ if (fgetpwent_r(file, &pwd, line_buff, sizeof(line_buff), NULL) != -1) {
return &pwd;
}
return NULL;