getgrent.c (4ccb26e49ae2de527a21c8146e8148f8effb827c) getgrent.c (e8420087b0ae4a2d0611cd2f6413d150cfc83554)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. 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

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

261 if (feof(_gr_fp))
262 return(0);
263
264 /* don't allocate infinite memory */
265 if (MAXLINELENGTHLIMIT > 0 &&
266 maxlinelength >= MAXLINELENGTHLIMIT)
267 return(0);
268
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. 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

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

261 if (feof(_gr_fp))
262 return(0);
263
264 /* don't allocate infinite memory */
265 if (MAXLINELENGTHLIMIT > 0 &&
266 maxlinelength >= MAXLINELENGTHLIMIT)
267 return(0);
268
269 if ((line = (char *)realloc(line,
269 if ((line = (char *)reallocf(line,
270 sizeof(char) *
271 (maxlinelength + MAXLINELENGTH))) == NULL)
272 return(0);
273
274 if (fgets(line + maxlinelength - 1,
275 MAXLINELENGTH + 1, _gr_fp) == NULL)
276 return(0);
277

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

376 else
377 members[0] = NULL;
378 bp = cp;
379 cp = NULL;
380#endif
381 for (m = members; ; bp++) {
382 if (m == (members + maxgrp - 1)) {
383 if ((members = (char **)
270 sizeof(char) *
271 (maxlinelength + MAXLINELENGTH))) == NULL)
272 return(0);
273
274 if (fgets(line + maxlinelength - 1,
275 MAXLINELENGTH + 1, _gr_fp) == NULL)
276 return(0);
277

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

376 else
377 members[0] = NULL;
378 bp = cp;
379 cp = NULL;
380#endif
381 for (m = members; ; bp++) {
382 if (m == (members + maxgrp - 1)) {
383 if ((members = (char **)
384 realloc(members,
384 reallocf(members,
385 sizeof(char **) *
386 (maxgrp + MAXGRP))) == NULL)
387 return(0);
388 m = members + maxgrp - 1;
389 maxgrp += MAXGRP;
390 }
391 if (*bp == ',') {
392 if (cp) {

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

434 if ((s = strsep(&result, ":")) == NULL) return 0; /* gid */
435 gr->gr_gid = atoi(s);
436
437 if ((s = result) == NULL) return 0;
438 cp = 0;
439
440 for (m = members; ; s++) {
441 if (m == members + maxgrp - 1) {
385 sizeof(char **) *
386 (maxgrp + MAXGRP))) == NULL)
387 return(0);
388 m = members + maxgrp - 1;
389 maxgrp += MAXGRP;
390 }
391 if (*bp == ',') {
392 if (cp) {

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

434 if ((s = strsep(&result, ":")) == NULL) return 0; /* gid */
435 gr->gr_gid = atoi(s);
436
437 if ((s = result) == NULL) return 0;
438 cp = 0;
439
440 for (m = members; ; s++) {
441 if (m == members + maxgrp - 1) {
442 if ((members = (char **)realloc(members,
442 if ((members = (char **)reallocf(members,
443 sizeof(char **) * (maxgrp + MAXGRP))) == NULL)
444 return(0);
445 m = members + maxgrp - 1;
446 maxgrp += MAXGRP;
447 }
448 if (*s == ',') {
449 if (cp) {
450 *s = '\0';

--- 103 unchanged lines hidden ---
443 sizeof(char **) * (maxgrp + MAXGRP))) == NULL)
444 return(0);
445 m = members + maxgrp - 1;
446 maxgrp += MAXGRP;
447 }
448 if (*s == ',') {
449 if (cp) {
450 *s = '\0';

--- 103 unchanged lines hidden ---