summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/getspuid.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-06-12 23:27:00 +0000
committerEric Andersen <andersen@codepoet.org>2002-06-12 23:27:00 +0000
commitc617db9065afa51100199d9ac4561feee4279291 (patch)
treee4a90725f73b9fb7ec9970ca495172181acfa873 /libc/pwd_grp/getspuid.c
parentfd6b9378be20243eaea7da1c2ddb3d68f123d28e (diff)
Silence warnings, clean things up.
-Erik
Diffstat (limited to 'libc/pwd_grp/getspuid.c')
-rw-r--r--libc/pwd_grp/getspuid.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/libc/pwd_grp/getspuid.c b/libc/pwd_grp/getspuid.c
index 2f01cdca0..f06eb1ad0 100644
--- a/libc/pwd_grp/getspuid.c
+++ b/libc/pwd_grp/getspuid.c
@@ -20,31 +20,28 @@
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
-#include <pwd.h>
-#include <shadow.h>
-
-#define PWD_BUFFER_SIZE 256
+#include "config.h"
int getspuid_r (uid_t uid, struct spwd *spwd,
char *buff, size_t buflen, struct spwd **crap)
{
- char pwd_buff[PWD_BUFFER_SIZE];
- struct passwd password;
+ char pwd_buff[PWD_BUFFER_SIZE];
+ struct passwd password;
- if (getpwuid_r(uid, &password, pwd_buff, PWD_BUFFER_SIZE, NULL) < 0)
- return -1;
+ if (getpwuid_r(uid, &password, pwd_buff, sizeof(pwd_buff), NULL) < 0)
+ return -1;
- return getspnam_r(password.pw_name, spwd, buff, buflen, crap);
+ return getspnam_r(password.pw_name, spwd, buff, buflen, crap);
}
struct spwd *getspuid(uid_t uid)
{
- static char line_buff[PWD_BUFFER_SIZE];
- static struct spwd spwd;
+ static char line_buff[PWD_BUFFER_SIZE];
+ static struct spwd spwd;
- if (getspuid_r(uid, &spwd, line_buff, PWD_BUFFER_SIZE, NULL) != -1) {
- return &spwd;
- }
- return NULL;
+ if (getspuid_r(uid, &spwd, line_buff, sizeof(line_buff), NULL) != -1) {
+ return &spwd;
+ }
+ return NULL;
}