Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:15

0001 /**
0002  *  @file
0003  *
0004  *  @brief User Database Access Routines
0005  *  @ingroup libcsupport
0006  */
0007 
0008 /*
0009  *  Copyright (c) 1999-2009 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
0010  *  Copyright (c) 1999-2013 Joel Sherrill <joel.sherrill@OARcorp.com>
0011  *  Copyright (c) 2000-2001 Fernando Ruiz Casas <fruizcasas@gmail.com>
0012  *  Copyright (c) 2002 Eric Norum <eric@norum.ca>
0013  *  Copyright (c) 2003 Till Straumann <strauman@slac.stanford.edu>
0014  *  Copyright (c) 2012 Alex Ivanov <alexivanov97@gmail.com>
0015  *
0016  *  The license and distribution terms for this file may be
0017  *  found in the file LICENSE in this distribution or at
0018  *  http://www.rtems.org/license/LICENSE.
0019  */
0020 
0021 #ifdef HAVE_CONFIG_H
0022 #include "config.h"
0023 #endif
0024 
0025 #include "pwdgrp.h"
0026 
0027 /*
0028  * Static, thread-unsafe, buffers
0029  */
0030 static char grbuf[200];
0031 static struct group grent;
0032 
0033 struct group *getgrnam(
0034   const char *name
0035 )
0036 {
0037   struct group *p;
0038 
0039   if(getgrnam_r(name, &grent, grbuf, sizeof grbuf, &p))
0040     return NULL;
0041   return p;
0042 }
0043 
0044 struct group *getgrgid(
0045   gid_t gid
0046 )
0047 {
0048   struct group *p;
0049 
0050   if(getgrgid_r(gid, &grent, grbuf, sizeof grbuf, &p))
0051     return NULL;
0052   return p;
0053 }