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/newusers.c
static void close_files(void)
{
    if (pw_close() == 0)
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                pw_dbname());
        SYSLOG((LOG_ERR, "failure while writing changes to %s", pw_dbname()));
        fail_exit(EXIT_FAILURE);
    }
    if (pw_unlock() == 0)
    {
        fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname());
        SYSLOG((LOG_ERR, "failed to unlock %s", pw_dbname()));
        /* continue */
    }
    pw_locked = false;

    if (is_shadow)
    {
        if (spw_close() == 0)
        {
            fprintf(stderr, _("%s: failure while writing changes to %s\n"),
                    Prog, spw_dbname());
            SYSLOG(
                (LOG_ERR, "failure while writing changes to %s", spw_dbname()));
            fail_exit(EXIT_FAILURE);
        }
        if (spw_unlock() == 0)
        {
            fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname());
            SYSLOG((LOG_ERR, "failed to unlock %s", spw_dbname()));
            /* continue */
        }
        spw_locked = false;
    }

    if (gr_close() == 0)
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                gr_dbname());
        SYSLOG((LOG_ERR, "failure while writing changes to %s", gr_dbname()));
        fail_exit(EXIT_FAILURE);
    }
#ifdef ENABLE_SUBIDS
    if (is_sub_uid && (sub_uid_close() == 0))
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                sub_uid_dbname());
        SYSLOG(
            (LOG_ERR, "failure while writing changes to %s", sub_uid_dbname()));
        fail_exit(EXIT_FAILURE);
    }
    if (is_sub_gid && (sub_gid_close() == 0))
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                sub_gid_dbname());
        SYSLOG(
            (LOG_ERR, "failure while writing changes to %s", sub_gid_dbname()));
        fail_exit(EXIT_FAILURE);
    }
#endif /* ENABLE_SUBIDS */

    if (gr_unlock() == 0)
    {
        fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname());
        SYSLOG((LOG_ERR, "failed to unlock %s", gr_dbname()));
        /* continue */
    }
    gr_locked = false;

#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_close() == 0)
        {
            fprintf(stderr, _("%s: failure while writing changes to %s\n"),
                    Prog, sgr_dbname());
            SYSLOG(
                (LOG_ERR, "failure while writing changes to %s", sgr_dbname()));
            fail_exit(EXIT_FAILURE);
        }
        if (sgr_unlock() == 0)
        {
            fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname());
            SYSLOG((LOG_ERR, "failed to unlock %s", sgr_dbname()));
            /* continue */
        }
        sgr_locked = false;
    }
#endif
#ifdef ENABLE_SUBIDS
    if (is_sub_uid)
    {
        if (sub_uid_unlock() == 0)
        {
            fprintf(stderr, _("%s: failed to unlock %s\n"), Prog,
                    sub_uid_dbname());
            SYSLOG((LOG_ERR, "failed to unlock %s", sub_uid_dbname()));
            /* continue */
        }
        sub_uid_locked = false;
    }
    if (is_sub_gid)
    {
        if (sub_gid_unlock() == 0)
        {
            fprintf(stderr, _("%s: failed to unlock %s\n"), Prog,
                    sub_gid_dbname());
            SYSLOG((LOG_ERR, "failed to unlock %s", sub_gid_dbname()));
            /* continue */
        }
        sub_gid_locked = false;
    }
#endif /* ENABLE_SUBIDS */
}
/*
 * close_files - close and unlock the password, group and shadow databases
 */
close and unlock the password, group and shadow databases
close and unlock the password group and shadow databases
static void close_files(void)
{
    if (pw_close() == 0)
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                pw_dbname());
        SYSLOG((LOG_ERR, "failure while writing changes to %s", pw_dbname()));
        fail_exit(EXIT_FAILURE);
    }
    if (pw_unlock() == 0)
    {
        fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, pw_dbname());
        SYSLOG((LOG_ERR, "failed to unlock %s", pw_dbname()));
    }
    pw_locked = false;
    if (is_shadow)
    {
        if (spw_close() == 0)
        {
            fprintf(stderr, _("%s: failure while writing changes to %s\n"),
                    Prog, spw_dbname());
            SYSLOG(
                (LOG_ERR, "failure while writing changes to %s", spw_dbname()));
            fail_exit(EXIT_FAILURE);
        }
        if (spw_unlock() == 0)
        {
            fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, spw_dbname());
            SYSLOG((LOG_ERR, "failed to unlock %s", spw_dbname()));
        }
        spw_locked = false;
    }
    if (gr_close() == 0)
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                gr_dbname());
        SYSLOG((LOG_ERR, "failure while writing changes to %s", gr_dbname()));
        fail_exit(EXIT_FAILURE);
    }
#ifdef ENABLE_SUBIDS
    if (is_sub_uid && (sub_uid_close() == 0))
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                sub_uid_dbname());
        SYSLOG(
            (LOG_ERR, "failure while writing changes to %s", sub_uid_dbname()));
        fail_exit(EXIT_FAILURE);
    }
    if (is_sub_gid && (sub_gid_close() == 0))
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                sub_gid_dbname());
        SYSLOG(
            (LOG_ERR, "failure while writing changes to %s", sub_gid_dbname()));
        fail_exit(EXIT_FAILURE);
    }
#endif 
    if (gr_unlock() == 0)
    {
        fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, gr_dbname());
        SYSLOG((LOG_ERR, "failed to unlock %s", gr_dbname()));
    }
    gr_locked = false;
#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_close() == 0)
        {
            fprintf(stderr, _("%s: failure while writing changes to %s\n"),
                    Prog, sgr_dbname());
            SYSLOG(
                (LOG_ERR, "failure while writing changes to %s", sgr_dbname()));
            fail_exit(EXIT_FAILURE);
        }
        if (sgr_unlock() == 0)
        {
            fprintf(stderr, _("%s: failed to unlock %s\n"), Prog, sgr_dbname());
            SYSLOG((LOG_ERR, "failed to unlock %s", sgr_dbname()));
        }
        sgr_locked = false;
    }
#endif
#ifdef ENABLE_SUBIDS
    if (is_sub_uid)
    {
        if (sub_uid_unlock() == 0)
        {
            fprintf(stderr, _("%s: failed to unlock %s\n"), Prog,
                    sub_uid_dbname());
            SYSLOG((LOG_ERR, "failed to unlock %s", sub_uid_dbname()));
        }
        sub_uid_locked = false;
    }
    if (is_sub_gid)
    {
        if (sub_gid_unlock() == 0)
        {
            fprintf(stderr, _("%s: failed to unlock %s\n"), Prog,
                    sub_gid_dbname());
            SYSLOG((LOG_ERR, "failed to unlock %s", sub_gid_dbname()));
        }
        sub_gid_locked = false;
    }
#endif 
}
static void close_files ( void ) { if ( pw_close ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , pw_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , pw_dbname ( ) ) ) ; fail_exit ( EXIT_FAILURE ) ; } if ( pw_unlock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , pw_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , pw_dbname ( ) ) ) ; } pw_locked = false ; if ( is_shadow ) { if ( spw_close ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , spw_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , spw_dbname ( ) ) ) ; fail_exit ( EXIT_FAILURE ) ; } if ( spw_unlock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , spw_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , spw_dbname ( ) ) ) ; } spw_locked = false ; } if ( gr_close ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , gr_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , gr_dbname ( ) ) ) ; fail_exit ( EXIT_FAILURE ) ; } #ifdef ENABLE_SUBIDS if ( is_sub_uid && ( sub_uid_close ( ) == 0 ) ) { fprintf ( stderr , _ ( " \n " ) , Prog , sub_uid_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , sub_uid_dbname ( ) ) ) ; fail_exit ( EXIT_FAILURE ) ; } if ( is_sub_gid && ( sub_gid_close ( ) == 0 ) ) { fprintf ( stderr , _ ( " \n " ) , Prog , sub_gid_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , sub_gid_dbname ( ) ) ) ; fail_exit ( EXIT_FAILURE ) ; } #endif if ( gr_unlock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , gr_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , gr_dbname ( ) ) ) ; } gr_locked = false ; #ifdef SHADOWGRP if ( is_shadow_grp ) { if ( sgr_close ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sgr_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , sgr_dbname ( ) ) ) ; fail_exit ( EXIT_FAILURE ) ; } if ( sgr_unlock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sgr_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , sgr_dbname ( ) ) ) ; } sgr_locked = false ; } #endif #ifdef ENABLE_SUBIDS if ( is_sub_uid ) { if ( sub_uid_unlock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sub_uid_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , sub_uid_dbname ( ) ) ) ; } sub_uid_locked = false ; } if ( is_sub_gid ) { if ( sub_gid_unlock ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sub_gid_dbname ( ) ) ; SYSLOG ( ( LOG_ERR , " " , sub_gid_dbname ( ) ) ) ; } sub_gid_locked = false ; } #endif }
close_files - close and unlock the password, group and shadow databases
close_files - close and unlock the password group and shadow databases
/* continue */ /* continue */ /* ENABLE_SUBIDS */ /* continue */ /* continue */ /* continue */ /* continue */ /* ENABLE_SUBIDS */