summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/getpwnam.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/pwd_grp/getpwnam.c')
-rw-r--r--libc/pwd_grp/getpwnam.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/libc/pwd_grp/getpwnam.c b/libc/pwd_grp/getpwnam.c
index 85dbc8ed8..63671927b 100644
--- a/libc/pwd_grp/getpwnam.c
+++ b/libc/pwd_grp/getpwnam.c
@@ -25,28 +25,25 @@
#include <pwd.h>
-struct passwd *
-getpwnam(const char * name)
+struct passwd *getpwnam(const char *name)
{
- int passwd_fd;
- struct passwd * passwd;
+ int passwd_fd;
+ struct passwd *passwd;
- if (name==NULL)
- {
- errno=EINVAL;
- return NULL;
- }
+ if (name == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
- if ((passwd_fd=open("/etc/passwd", O_RDONLY))<0)
- return NULL;
+ if ((passwd_fd = open("/etc/passwd", O_RDONLY)) < 0)
+ return NULL;
- while ((passwd=__getpwent(passwd_fd))!=NULL)
- if (!strcmp(passwd->pw_name, name))
- {
- close(passwd_fd);
- return passwd;
- }
+ while ((passwd = __getpwent(passwd_fd)) != NULL)
+ if (!strcmp(passwd->pw_name, name)) {
+ close(passwd_fd);
+ return passwd;
+ }
- close(passwd_fd);
- return NULL;
+ close(passwd_fd);
+ return NULL;
}