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 close_files(void)
{
    /* First, write the changes in the regular group database */
    if (gr_close() == 0)
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                gr_dbname());
        exit(E_GRP_UPDATE);
    }
#ifdef WITH_AUDIT
    audit_logger(AUDIT_ADD_GROUP, Prog, "adding group to /etc/group",
                 group_name, (unsigned int)group_id, SHADOW_AUDIT_SUCCESS);
#endif
    SYSLOG((LOG_INFO, "group added to %s: name=%s, GID=%u", gr_dbname(),
            group_name, (unsigned int)group_id));
    del_cleanup(cleanup_report_add_group_group);

    cleanup_unlock_group(NULL);
    del_cleanup(cleanup_unlock_group);

    /* Now, write the changes in the shadow database */
#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_close() == 0)
        {
            fprintf(stderr, _("%s: failure while writing changes to %s\n"),
                    Prog, sgr_dbname());
            exit(E_GRP_UPDATE);
        }
#ifdef WITH_AUDIT
        audit_logger(AUDIT_ADD_GROUP, Prog, "adding group to /etc/gshadow",
                     group_name, (unsigned int)group_id, SHADOW_AUDIT_SUCCESS);
#endif
        SYSLOG(
            (LOG_INFO, "group added to %s: name=%s", sgr_dbname(), group_name));
        del_cleanup(cleanup_report_add_group_gshadow);

        cleanup_unlock_gshadow(NULL);
        del_cleanup(cleanup_unlock_gshadow);
    }
#endif /* SHADOWGRP */

    /* Report success at the system level */
#ifdef WITH_AUDIT
    audit_logger(AUDIT_ADD_GROUP, Prog, "", group_name, (unsigned int)group_id,
                 SHADOW_AUDIT_SUCCESS);
#endif
    SYSLOG((LOG_INFO, "new group: name=%s, GID=%u", group_name,
            (unsigned int)group_id));
    del_cleanup(cleanup_report_add_group);
}
/*
 * close_files - close all of the files that were opened
 *
 *	close_files() closes all of the files that were opened for this new
 *	group. This causes any modified entries to be written out.
 */
close all of the files that were opened
close_files() closes all of the files that were opened for this new
group. This causes any modified entries to be written out.
close all of the files that were opened close_files () closes all of the files that were opened for this new group . This causes any modified entries to be written out .
static void close_files(void)
{
    if (gr_close() == 0)
    {
        fprintf(stderr, _("%s: failure while writing changes to %s\n"), Prog,
                gr_dbname());
        exit(E_GRP_UPDATE);
    }
#ifdef WITH_AUDIT
    audit_logger(AUDIT_ADD_GROUP, Prog, "adding group to /etc/group",
                 group_name, (unsigned int)group_id, SHADOW_AUDIT_SUCCESS);
#endif
    SYSLOG((LOG_INFO, "group added to %s: name=%s, GID=%u", gr_dbname(),
            group_name, (unsigned int)group_id));
    del_cleanup(cleanup_report_add_group_group);
    cleanup_unlock_group(NULL);
    del_cleanup(cleanup_unlock_group);
#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        if (sgr_close() == 0)
        {
            fprintf(stderr, _("%s: failure while writing changes to %s\n"),
                    Prog, sgr_dbname());
            exit(E_GRP_UPDATE);
        }
#ifdef WITH_AUDIT
        audit_logger(AUDIT_ADD_GROUP, Prog, "adding group to /etc/gshadow",
                     group_name, (unsigned int)group_id, SHADOW_AUDIT_SUCCESS);
#endif
        SYSLOG(
            (LOG_INFO, "group added to %s: name=%s", sgr_dbname(), group_name));
        del_cleanup(cleanup_report_add_group_gshadow);
        cleanup_unlock_gshadow(NULL);
        del_cleanup(cleanup_unlock_gshadow);
    }
#endif 
#ifdef WITH_AUDIT
    audit_logger(AUDIT_ADD_GROUP, Prog, "", group_name, (unsigned int)group_id,
                 SHADOW_AUDIT_SUCCESS);
#endif
    SYSLOG((LOG_INFO, "new group: name=%s, GID=%u", group_name,
            (unsigned int)group_id));
    del_cleanup(cleanup_report_add_group);
}
static void close_files ( void ) { if ( gr_close ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , gr_dbname ( ) ) ; exit ( E_GRP_UPDATE ) ; } #ifdef WITH_AUDIT audit_logger ( AUDIT_ADD_GROUP , Prog , " " , group_name , ( unsigned int ) group_id , SHADOW_AUDIT_SUCCESS ) ; #endif SYSLOG ( ( LOG_INFO , " " , gr_dbname ( ) , group_name , ( unsigned int ) group_id ) ) ; del_cleanup ( cleanup_report_add_group_group ) ; cleanup_unlock_group ( NULL ) ; del_cleanup ( cleanup_unlock_group ) ; #ifdef SHADOWGRP if ( is_shadow_grp ) { if ( sgr_close ( ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , sgr_dbname ( ) ) ; exit ( E_GRP_UPDATE ) ; } #ifdef WITH_AUDIT audit_logger ( AUDIT_ADD_GROUP , Prog , " " , group_name , ( unsigned int ) group_id , SHADOW_AUDIT_SUCCESS ) ; #endif SYSLOG ( ( LOG_INFO , " " , sgr_dbname ( ) , group_name ) ) ; del_cleanup ( cleanup_report_add_group_gshadow ) ; cleanup_unlock_gshadow ( NULL ) ; del_cleanup ( cleanup_unlock_gshadow ) ; } #endif #ifdef WITH_AUDIT audit_logger ( AUDIT_ADD_GROUP , Prog , " " , group_name , ( unsigned int ) group_id , SHADOW_AUDIT_SUCCESS ) ; #endif SYSLOG ( ( LOG_INFO , " " , group_name , ( unsigned int ) group_id ) ) ; del_cleanup ( cleanup_report_add_group ) ; }
close_files - close all of the files that were opened
      close_files() closes all of the files that were opened for this new
      group.
close_files - close all of the files that were opened close_files () closes all of the files that were opened for this new group .
/* First, write the changes in the regular group database */ /* Now, write the changes in the shadow database */ /* SHADOWGRP */ /* Report success at the system level */