diff options
Diffstat (limited to 'libc/pwd_grp/getpwuid.c')
-rw-r--r-- | libc/pwd_grp/getpwuid.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libc/pwd_grp/getpwuid.c b/libc/pwd_grp/getpwuid.c index ffd58c1f0..1cd0d691c 100644 --- a/libc/pwd_grp/getpwuid.c +++ b/libc/pwd_grp/getpwuid.c @@ -23,22 +23,20 @@ #include <fcntl.h> #include <pwd.h> -struct passwd * -getpwuid(uid_t uid) +struct passwd *getpwuid(uid_t uid) { - int passwd_fd; - struct passwd * passwd; + int passwd_fd; + struct passwd *passwd; - 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 (passwd->pw_uid==uid) - { - close(passwd_fd); - return passwd; - } + while ((passwd = __getpwent(passwd_fd)) != NULL) + if (passwd->pw_uid == uid) { + close(passwd_fd); + return passwd; + } - close (passwd_fd); - return NULL; + close(passwd_fd); + return NULL; } |