From c617db9065afa51100199d9ac4561feee4279291 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 12 Jun 2002 23:27:00 +0000 Subject: Silence warnings, clean things up. -Erik --- libc/pwd_grp/spent.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'libc/pwd_grp/spent.c') diff --git a/libc/pwd_grp/spent.c b/libc/pwd_grp/spent.c index 196a952bd..c1305b15e 100644 --- a/libc/pwd_grp/spent.c +++ b/libc/pwd_grp/spent.c @@ -20,8 +20,8 @@ #include #include #include -#include #include +#include "config.h" /* * setspent(), endspent(), and getspent() are included in the same object @@ -29,43 +29,41 @@ * link them all in together. */ -#define PWD_BUFFER_SIZE 256 - /* file descriptor for the password file currently open */ static int spwd_fd = -1; void setspent(void) { - if (spwd_fd != -1) - close(spwd_fd); + if (spwd_fd != -1) + close(spwd_fd); - spwd_fd = open(_PATH_SHADOW, O_RDONLY); + spwd_fd = open(_PATH_SHADOW, O_RDONLY); } void endspent(void) { - if (spwd_fd != -1) - close(spwd_fd); - spwd_fd = -1; + if (spwd_fd != -1) + close(spwd_fd); + spwd_fd = -1; } int getspent_r (struct spwd *spwd, char *buff, size_t buflen, struct spwd **crap) { - if (spwd_fd != -1 && __getspent_r(spwd, buff, buflen, spwd_fd) != -1) { - return 0; - } - return -1; + if (spwd_fd != -1 && __getspent_r(spwd, buff, buflen, spwd_fd) != -1) { + return 0; + } + return -1; } struct spwd *getspent(void) { - static char line_buff[PWD_BUFFER_SIZE]; - static struct spwd spwd; + static char line_buff[PWD_BUFFER_SIZE]; + static struct spwd spwd; - if (getspent_r(&spwd, line_buff, PWD_BUFFER_SIZE, NULL) != -1) { - return &spwd; - } - return NULL; + if (getspent_r(&spwd, line_buff, sizeof(line_buff), NULL) != -1) { + return &spwd; + } + return NULL; } -- cgit v1.2.3