Deleted Added
full compact
gr_util.c (248102) gr_util.c (273791)
1/*-
2 * Copyright (c) 2008 Sean C. Farley <scf@FreeBSD.org>
3 * 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

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Sean C. Farley <scf@FreeBSD.org>
3 * 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

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/lib/libutil/gr_util.c 248102 2013-03-09 13:30:06Z db $");
28__FBSDID("$FreeBSD: head/lib/libutil/gr_util.c 273791 2014-10-28 16:27:29Z bapt $");
29
30#include <sys/param.h>
31#include <sys/errno.h>
32#include <sys/stat.h>
33
34#include <ctype.h>
35#include <err.h>
36#include <fcntl.h>

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

165gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
166{
167 char buf[8192], *end, *line, *p, *q, *r, t;
168 struct group *fgr;
169 const struct group *sgr;
170 size_t len;
171 int eof, readlen;
172
29
30#include <sys/param.h>
31#include <sys/errno.h>
32#include <sys/stat.h>
33
34#include <ctype.h>
35#include <err.h>
36#include <fcntl.h>

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

165gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
166{
167 char buf[8192], *end, *line, *p, *q, *r, t;
168 struct group *fgr;
169 const struct group *sgr;
170 size_t len;
171 int eof, readlen;
172
173 sgr = gr;
173 if (old_gr == NULL && gr == NULL)
174 return(-1);
175
176 sgr = old_gr;
177 /* deleting a group */
174 if (gr == NULL) {
175 line = NULL;
178 if (gr == NULL) {
179 line = NULL;
176 if (old_gr == NULL)
180 } else {
181 if ((line = gr_make(gr)) == NULL)
177 return (-1);
182 return (-1);
178 sgr = old_gr;
179 } else if ((line = gr_make(gr)) == NULL)
180 return (-1);
183 }
181
184
185 /* adding a group */
186 if (sgr == NULL)
187 sgr = gr;
188
182 eof = 0;
183 len = 0;
184 p = q = end = buf;
185 for (;;) {
186 /* find the end of the current line */
187 for (p = q; q < end && *q != '\0'; ++q)
188 if (*q == '\n')
189 break;

--- 442 unchanged lines hidden ---
189 eof = 0;
190 len = 0;
191 p = q = end = buf;
192 for (;;) {
193 /* find the end of the current line */
194 for (p = q; q < end && *q != '\0'; ++q)
195 if (*q == '\n')
196 break;

--- 442 unchanged lines hidden ---