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/chgpasswd.c
static void open_files(void)
{
    /*
     * Lock the group file and open it for reading and writing. This will
     * bring all of the entries into memory where they may be updated.
     */
    if (gr_lock() == 0)
    {
        fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                gr_dbname());
        fail_exit(1);
    }
    gr_locked = true;
    if (gr_open(O_CREAT | O_RDWR) == 0)
    {
        fprintf(stderr, _("%s: cannot open %s\n"), Prog, gr_dbname());
        fail_exit(1);
    }

#ifdef SHADOWGRP
    /* Do the same for the shadowed database, if it exist */
    if (is_shadow_grp)
    {
        if (sgr_lock() == 0)
        {
            fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                    sgr_dbname());
            fail_exit(1);
        }
        sgr_locked = true;
        if (sgr_open(O_CREAT | O_RDWR) == 0)
        {
            fprintf(stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname());
            fail_exit(1);
        }
    }
#endif
}
/*
 * open_files - lock and open the group databases
 */
lock and open the group databases
lock and open the group databases
static void open_files(void)
{
    if (gr_lock() == 0)
    {
        fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                gr_dbname());
        fail_exit(1);
    }
    gr_locked = true;
    if (gr_open(O_CREAT | O_RDWR) == 0)
    {
        fprintf(stderr, _("%s: cannot open %s\n"), Prog, gr_dbname());
        fail_exit(1);
    }
#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_lock() == 0)
        {
            fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                    sgr_dbname());
            fail_exit(1);
        }
        sgr_locked = true;
        if (sgr_open(O_CREAT | O_RDWR) == 0)
        {
            fprintf(stderr, _("%s: cannot open %s\n"), Prog, sgr_dbname());
            fail_exit(1);
        }
    }
#endif
}
static void open_files ( void ) { if ( gr_lock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , gr_dbname ( ) ) ; fail_exit ( 1 ) ; } gr_locked = true ; if ( gr_open ( O_CREAT | O_RDWR ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , gr_dbname ( ) ) ; fail_exit ( 1 ) ; } #ifdef SHADOWGRP if ( is_shadow_grp ) { if ( sgr_lock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sgr_dbname ( ) ) ; fail_exit ( 1 ) ; } sgr_locked = true ; if ( sgr_open ( O_CREAT | O_RDWR ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sgr_dbname ( ) ) ; fail_exit ( 1 ) ; } } #endif }
open_files - lock and open the group databases
open_files - lock and open the group databases
/*
     * Lock the group file and open it for reading and writing. This will
     * bring all of the entries into memory where they may be updated.
     */ /* Do the same for the shadowed database, if it exist */