openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/shadow/4.6-r0/shadow-4.6/src/groupadd.c
static void open_files(void)
{
    /* First, lock the databases */
    if (gr_lock() == 0)
    {
        fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                gr_dbname());
        exit(E_GRP_UPDATE);
    }
    add_cleanup(cleanup_unlock_group, NULL);

#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_lock() == 0)
        {
            fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                    sgr_dbname());
            exit(E_GRP_UPDATE);
        }
        add_cleanup(cleanup_unlock_gshadow, NULL);
    }
#endif /* SHADOWGRP */

    /*
     * Now if the group is not added, it's our fault.
     * Make sure failures will be reported.
     */
    add_cleanup(cleanup_report_add_group, group_name);

    /* And now open the databases */
    if (gr_open(O_CREAT | O_RDWR) == 0)
    {
        fprintf(stderr, _("%s: cannot open %s\n"), Prog, gr_dbname());
        SYSLOG((LOG_WARN, "cannot open %s", gr_dbname()));
        exit(E_GRP_UPDATE);
    }

#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_open(O_CREAT | O_RDWR) == 0)
        {
            fprintf(stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname());
            SYSLOG((LOG_WARN, "cannot open %s", sgr_dbname()));
            exit(E_GRP_UPDATE);
        }
    }
#endif /* SHADOWGRP */
}
/*
 * open_files - lock and open the group files
 *
 *	open_files() opens the two group files.
 */
lock and open the group files
open_files() opens the two group files.
lock and open the group files open_files () opens the two group files .
static void open_files(void)
{
    if (gr_lock() == 0)
    {
        fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                gr_dbname());
        exit(E_GRP_UPDATE);
    }
    add_cleanup(cleanup_unlock_group, NULL);
#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_lock() == 0)
        {
            fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                    sgr_dbname());
            exit(E_GRP_UPDATE);
        }
        add_cleanup(cleanup_unlock_gshadow, NULL);
    }
#endif 
    add_cleanup(cleanup_report_add_group, group_name);
    if (gr_open(O_CREAT | O_RDWR) == 0)
    {
        fprintf(stderr, _("%s: cannot open %s\n"), Prog, gr_dbname());
        SYSLOG((LOG_WARN, "cannot open %s", gr_dbname()));
        exit(E_GRP_UPDATE);
    }
#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_open(O_CREAT | O_RDWR) == 0)
        {
            fprintf(stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname());
            SYSLOG((LOG_WARN, "cannot open %s", sgr_dbname()));
            exit(E_GRP_UPDATE);
        }
    }
#endif 
}
static void open_files ( void ) { if ( gr_lock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , gr_dbname ( ) ) ; exit ( E_GRP_UPDATE ) ; } add_cleanup ( cleanup_unlock_group , NULL ) ; #ifdef SHADOWGRP if ( is_shadow_grp ) { if ( sgr_lock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sgr_dbname ( ) ) ; exit ( E_GRP_UPDATE ) ; } add_cleanup ( cleanup_unlock_gshadow , NULL ) ; } #endif add_cleanup ( cleanup_report_add_group , group_name ) ; if ( gr_open ( O_CREAT | O_RDWR ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , gr_dbname ( ) ) ; SYSLOG ( ( LOG_WARN , " " , gr_dbname ( ) ) ) ; exit ( E_GRP_UPDATE ) ; } #ifdef SHADOWGRP if ( is_shadow_grp ) { if ( sgr_open ( O_CREAT | O_RDWR ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sgr_dbname ( ) ) ; SYSLOG ( ( LOG_WARN , " " , sgr_dbname ( ) ) ) ; exit ( E_GRP_UPDATE ) ; } } #endif }
open_files - lock and open the group files
      open_files() opens the two group files.
open_files - lock and open the group files open_files () opens the two group files .
/* First, lock the databases */ /* SHADOWGRP */ /*
     * Now if the group is not added, it's our fault.
     * Make sure failures will be reported.
     */ /* And now open the databases */ /* SHADOWGRP */