summaryrefslogtreecommitdiffstats
path: root/libc/pwd_grp/getgrnam.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/pwd_grp/getgrnam.c')
-rw-r--r--libc/pwd_grp/getgrnam.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/libc/pwd_grp/getgrnam.c b/libc/pwd_grp/getgrnam.c
index e6c27fc57..999404284 100644
--- a/libc/pwd_grp/getgrnam.c
+++ b/libc/pwd_grp/getgrnam.c
@@ -24,28 +24,25 @@
#include <fcntl.h>
#include <grp.h>
-struct group *
-getgrnam(const char * name)
+struct group *getgrnam(const char *name)
{
- int grp_fd;
- struct group * group;
+ int grp_fd;
+ struct group *group;
- if (name==NULL)
- {
- errno=EINVAL;
- return NULL;
- }
+ if (name == NULL) {
+ errno = EINVAL;
+ return NULL;
+ }
- if ((grp_fd=open("/etc/group", O_RDONLY))<0)
- return NULL;
+ if ((grp_fd = open("/etc/group", O_RDONLY)) < 0)
+ return NULL;
- while ((group=__getgrent(grp_fd))!=NULL)
- if (!strcmp(group->gr_name, name))
- {
- close(grp_fd);
- return group;
- }
+ while ((group = __getgrent(grp_fd)) != NULL)
+ if (!strcmp(group->gr_name, name)) {
+ close(grp_fd);
+ return group;
+ }
- close(grp_fd);
- return NULL;
+ close(grp_fd);
+ return NULL;
}