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 grp_update(void)
{
    struct group grp;

#ifdef SHADOWGRP
    struct sgrp sgrp;
#endif /* SHADOWGRP */

    /*
     * To add the group, we need to update /etc/group.
     * Make sure failures will be reported.
     */
    add_cleanup(cleanup_report_add_group_group, group_name);
#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        /* We also need to update /etc/gshadow */
        add_cleanup(cleanup_report_add_group_gshadow, group_name);
    }
#endif

    /*
     * Create the initial entries for this new group.
     */
    new_grent(&grp);
#ifdef SHADOWGRP
    new_sgent(&sgrp);
    if (is_shadow_grp && pflg)
    {
        grp.gr_passwd = SHADOW_PASSWD_STRING; /* XXX warning: const */
    }
#endif /* SHADOWGRP */

    /*
     * Write out the new group file entry.
     */
    if (gr_update(&grp) == 0)
    {
        fprintf(stderr, _("%s: failed to prepare the new %s entry '%s'\n"),
                Prog, gr_dbname(), grp.gr_name);
        exit(E_GRP_UPDATE);
    }
#ifdef SHADOWGRP
    /*
     * Write out the new shadow group entries as well.
     */
    if (is_shadow_grp && (sgr_update(&sgrp) == 0))
    {
        fprintf(stderr, _("%s: failed to prepare the new %s entry '%s'\n"),
                Prog, sgr_dbname(), sgrp.sg_name);
        exit(E_GRP_UPDATE);
    }
#endif /* SHADOWGRP */
}
/*
 * grp_update - add new group file entries
 *
 *	grp_update() writes the new records to the group files.
 */
add new group file entries
grp_update() writes the new records to the group files.
add new group file entries grp_update () writes the new records to the group files .
static void grp_update(void)
{
    struct group grp;
#ifdef SHADOWGRP
    struct sgrp sgrp;
#endif 
    add_cleanup(cleanup_report_add_group_group, group_name);
#ifdef SHADOWGRP
    if (is_shadow_grp)
    {
        add_cleanup(cleanup_report_add_group_gshadow, group_name);
    }
#endif
    new_grent(&grp);
#ifdef SHADOWGRP
    new_sgent(&sgrp);
    if (is_shadow_grp && pflg)
    {
        grp.gr_passwd = SHADOW_PASSWD_STRING; 
    }
#endif 
    if (gr_update(&grp) == 0)
    {
        fprintf(stderr, _("%s: failed to prepare the new %s entry '%s'\n"),
                Prog, gr_dbname(), grp.gr_name);
        exit(E_GRP_UPDATE);
    }
#ifdef SHADOWGRP
    if (is_shadow_grp && (sgr_update(&sgrp) == 0))
    {
        fprintf(stderr, _("%s: failed to prepare the new %s entry '%s'\n"),
                Prog, sgr_dbname(), sgrp.sg_name);
        exit(E_GRP_UPDATE);
    }
#endif 
}
static void grp_update ( void ) { struct group grp ; #ifdef SHADOWGRP struct sgrp sgrp ; #endif add_cleanup ( cleanup_report_add_group_group , group_name ) ; #ifdef SHADOWGRP if ( is_shadow_grp ) { add_cleanup ( cleanup_report_add_group_gshadow , group_name ) ; } #endif new_grent ( & grp ) ; #ifdef SHADOWGRP new_sgent ( & sgrp ) ; if ( is_shadow_grp && pflg ) { grp . gr_passwd = SHADOW_PASSWD_STRING ; } #endif if ( gr_update ( & grp ) == 0 ) { fprintf ( stderr , _ ( " \n " ) , Prog , gr_dbname ( ) , grp . gr_name ) ; exit ( E_GRP_UPDATE ) ; } #ifdef SHADOWGRP if ( is_shadow_grp && ( sgr_update ( & sgrp ) == 0 ) ) { fprintf ( stderr , _ ( " \n " ) , Prog , sgr_dbname ( ) , sgrp . sg_name ) ; exit ( E_GRP_UPDATE ) ; } #endif }
grp_update - add new group file entries
      grp_update() writes the new records to the group files.
grp_update - add new group file entries grp_update () writes the new records to the group files .
/* SHADOWGRP */ /*
     * To add the group, we need to update /etc/group.
     * Make sure failures will be reported.
     */ /* We also need to update /etc/gshadow */ /*
     * Create the initial entries for this new group.
     */ /* XXX warning: const */ /* SHADOWGRP */ /*
     * Write out the new group file entry.
     */ /*
     * Write out the new shadow group entries as well.
     */ /* SHADOWGRP */