diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-06-12 23:27:00 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-06-12 23:27:00 +0000 |
commit | c617db9065afa51100199d9ac4561feee4279291 (patch) | |
tree | e4a90725f73b9fb7ec9970ca495172181acfa873 /libc/pwd_grp/spent.c | |
parent | fd6b9378be20243eaea7da1c2ddb3d68f123d28e (diff) |
Silence warnings, clean things up.
-Erik
Diffstat (limited to 'libc/pwd_grp/spent.c')
-rw-r--r-- | libc/pwd_grp/spent.c | 36 |
1 files changed, 17 insertions, 19 deletions
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 <unistd.h> #include <stdlib.h> #include <errno.h> -#include <shadow.h> #include <fcntl.h> +#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; } |