Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/loginutils/addgroup.c

    r3232 r3621  
    1010 *
    1111 */
     12//config:config ADDGROUP
     13//config:   bool "addgroup"
     14//config:   default y
     15//config:   help
     16//config:     Utility for creating a new group account.
     17//config:
     18//config:config FEATURE_ADDGROUP_LONG_OPTIONS
     19//config:   bool "Enable long options"
     20//config:   default y
     21//config:   depends on ADDGROUP && LONG_OPTS
     22//config:   help
     23//config:     Support long options for the addgroup applet.
     24//config:
     25//config:config FEATURE_ADDUSER_TO_GROUP
     26//config:   bool "Support for adding users to groups"
     27//config:   default y
     28//config:   depends on ADDGROUP
     29//config:   help
     30//config:     If  called  with two non-option arguments,
     31//config:     addgroup will add an existing user to an
     32//config:     existing group.
     33
     34//applet:IF_ADDGROUP(APPLET(addgroup, BB_DIR_USR_SBIN, BB_SUID_DROP))
     35
     36//kbuild:lib-$(CONFIG_ADDGROUP) += addgroup.o
    1237
    1338//usage:#define addgroup_trivial_usage
    14 //usage:       "[-g GID] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP"
     39//usage:       "[-g GID] [-S] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP"
    1540//usage:#define addgroup_full_usage "\n\n"
    16 //usage:       "Add a group " IF_FEATURE_ADDUSER_TO_GROUP("or add a user to a group") "\n"
     41//usage:       "Add a group" IF_FEATURE_ADDUSER_TO_GROUP(" or add a user to a group") "\n"
    1742//usage:     "\n    -g GID  Group id"
    1843//usage:     "\n    -S  Create a system group"
     
    2348#error Bad LAST_SYSTEM_ID or FIRST_SYSTEM_ID in .config
    2449#endif
     50#if CONFIG_LAST_ID < CONFIG_LAST_SYSTEM_ID
     51#error Bad LAST_ID or LAST_SYSTEM_ID in .config
     52#endif
    2553
    2654#define OPT_GID                       (1 << 0)
    2755#define OPT_SYSTEM_ACCOUNT            (1 << 1)
    2856
    29 /* We assume GID_T_MAX == INT_MAX */
    3057static void xgroup_study(struct group *g)
    3158{
    32     unsigned max = INT_MAX;
     59    unsigned max = CONFIG_LAST_ID;
    3360
    3461    /* Make sure gr_name is unused */
     
    4774        } else {
    4875            g->gr_gid = CONFIG_LAST_SYSTEM_ID + 1;
    49             max = 64999;
    5076        }
    5177    }
     
    126152{
    127153    unsigned opts;
    128     unsigned gid = 0;
     154    const char *gid = "0";
    129155
    130156    /* need to be root */
     
    140166     *  addgroup user group
    141167     * Check for min, max and missing args */
    142     opt_complementary = "-1:?2:g+";
     168    opt_complementary = "-1:?2";
    143169    opts = getopt32(argv, "g:S", &gid);
    144170    /* move past the commandline options */
     
    176202    {
    177203        die_if_bad_username(argv[0]);
    178         new_group(argv[0], gid);
     204        new_group(argv[0], xatou_range(gid, 0, CONFIG_LAST_ID));
    179205    }
    180206    /* Reached only on success */
Note: See TracChangeset for help on using the changeset viewer.