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

    /* Do the same for the shadowed database, if it exist */
    if (is_shadow_pwd)
    {
        if (spw_lock() == 0)
        {
            fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                    spw_dbname());
            fail_exit(1);
        }
        spw_locked = true;
        if (spw_open(O_CREAT | O_RDWR) == 0)
        {
            fprintf(stderr, _("%s: cannot open %s\n"), Prog, spw_dbname());
            fail_exit(1);
        }
    }
}
/*
 * open_files - lock and open the password databases
 */
lock and open the password databases
lock and open the password databases
static void open_files(void)
{
    if (pw_lock() == 0)
    {
        fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                pw_dbname());
        fail_exit(1);
    }
    pw_locked = true;
    if (pw_open(O_CREAT | O_RDWR) == 0)
    {
        fprintf(stderr, _("%s: cannot open %s\n"), Prog, pw_dbname());
        fail_exit(1);
    }
    if (is_shadow_pwd)
    {
        if (spw_lock() == 0)
        {
            fprintf(stderr, _("%s: cannot lock %s; try again later.\n"), Prog,
                    spw_dbname());
            fail_exit(1);
        }
        spw_locked = true;
        if (spw_open(O_CREAT | O_RDWR) == 0)
        {
            fprintf(stderr, _("%s: cannot open %s\n"), Prog, spw_dbname());
            fail_exit(1);
        }
    }
}
static void open_files ( void ) { if ( pw_lock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , pw_dbname ( ) ) ; fail_exit ( 1 ) ; } pw_locked = true ; if ( pw_open ( O_CREAT | O_RDWR ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , pw_dbname ( ) ) ; fail_exit ( 1 ) ; } if ( is_shadow_pwd ) { if ( spw_lock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , spw_dbname ( ) ) ; fail_exit ( 1 ) ; } spw_locked = true ; if ( spw_open ( O_CREAT | O_RDWR ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , spw_dbname ( ) ) ; fail_exit ( 1 ) ; } } }
open_files - lock and open the password databases
open_files - lock and open the password databases
/*
     * Lock the password 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 */