Deleted Added
full compact
pw_group.c (286201) pw_group.c (286203)
1/*-
2 * Copyright (C) 1996
3 * David L. Nugent. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
1/*-
2 * Copyright (C) 1996
3 * David L. Nugent. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
29 "$FreeBSD: head/usr.sbin/pw/pw_group.c 286201 2015-08-02 13:22:46Z bapt $";
29 "$FreeBSD: head/usr.sbin/pw/pw_group.c 286203 2015-08-02 13:33:17Z bapt $";
30#endif /* not lint */
31
32#include <ctype.h>
33#include <err.h>
34#include <grp.h>
35#include <libutil.h>
36#include <paths.h>
37#include <string.h>

--- 137 unchanged lines hidden (view full) ---

175
176 /*
177 * Check the given gid, if any
178 */
179 if (id > 0) {
180 gid = (gid_t) id;
181
182 if ((grp = GETGRGID(gid)) != NULL && conf.checkduplicate)
30#endif /* not lint */
31
32#include <ctype.h>
33#include <err.h>
34#include <grp.h>
35#include <libutil.h>
36#include <paths.h>
37#include <string.h>

--- 137 unchanged lines hidden (view full) ---

175
176 /*
177 * Check the given gid, if any
178 */
179 if (id > 0) {
180 gid = (gid_t) id;
181
182 if ((grp = GETGRGID(gid)) != NULL && conf.checkduplicate)
183 errx(EX_DATAERR, "gid `%ju' has already been allocated", (uintmax_t)grp->gr_gid);
183 errx(EX_DATAERR, "gid `%ju' has already been allocated",
184 (uintmax_t)grp->gr_gid);
184 return (gid);
185 }
186
187 /*
188 * We need to allocate the next available gid under one of
189 * two policies a) Grab the first unused gid b) Grab the
190 * highest possible unused gid
191 */

--- 25 unchanged lines hidden (view full) ---

217 else
218 gid = (gid_t) (bm_firstunset(&bm) + cnf->min_gid);
219 }
220
221 /*
222 * Another sanity check
223 */
224 if (gid < cnf->min_gid || gid > cnf->max_gid)
185 return (gid);
186 }
187
188 /*
189 * We need to allocate the next available gid under one of
190 * two policies a) Grab the first unused gid b) Grab the
191 * highest possible unused gid
192 */

--- 25 unchanged lines hidden (view full) ---

218 else
219 gid = (gid_t) (bm_firstunset(&bm) + cnf->min_gid);
220 }
221
222 /*
223 * Another sanity check
224 */
225 if (gid < cnf->min_gid || gid > cnf->max_gid)
225 errx(EX_SOFTWARE, "unable to allocate a new gid - range fully used");
226 errx(EX_SOFTWARE, "unable to allocate a new gid - range fully "
227 "used");
226 bm_dealloc(&bm);
227 return (gid);
228}
229
230static int
231print_group(struct group * grp, bool pretty)
232{
233 char *buf = NULL;

--- 454 unchanged lines hidden ---
228 bm_dealloc(&bm);
229 return (gid);
230}
231
232static int
233print_group(struct group * grp, bool pretty)
234{
235 char *buf = NULL;

--- 454 unchanged lines hidden ---