ccdconfig.c (227081) | ccdconfig.c (241848) |
---|---|
1/* 2 * Copyright (c) 2003 Poul-Henning Kamp 3 * Copyright (c) 1995 Jason R. Thorpe. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2003 Poul-Henning Kamp 3 * Copyright (c) 1995 Jason R. Thorpe. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 28 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sbin/ccdconfig/ccdconfig.c 227081 2011-11-04 13:36:02Z ed $"); | 35__FBSDID("$FreeBSD: head/sbin/ccdconfig/ccdconfig.c 241848 2012-10-22 03:07:05Z eadler $"); |
36 37#include <sys/param.h> 38#include <sys/linker.h> 39#include <sys/module.h> 40#include <ctype.h> 41#include <err.h> 42#include <errno.h> 43#include <limits.h> --- 239 unchanged lines hidden (view full) --- 283 FILE *f; 284 char line[_POSIX2_LINE_MAX]; 285 char *cp, **argv; 286 int argc, rval; 287 gid_t egid; 288 289 rval = 0; 290 egid = getegid(); | 36 37#include <sys/param.h> 38#include <sys/linker.h> 39#include <sys/module.h> 40#include <ctype.h> 41#include <err.h> 42#include <errno.h> 43#include <limits.h> --- 239 unchanged lines hidden (view full) --- 283 FILE *f; 284 char line[_POSIX2_LINE_MAX]; 285 char *cp, **argv; 286 int argc, rval; 287 gid_t egid; 288 289 rval = 0; 290 egid = getegid(); |
291 setegid(getgid()); | 291 if (setegid(getgid()) != 0) 292 err(1, "setegid failed"); |
292 if ((f = fopen(ccdconf, "r")) == NULL) { | 293 if ((f = fopen(ccdconf, "r")) == NULL) { |
293 setegid(egid); | 294 if (setegid(egid) != 0) 295 err(1, "setegid failed"); |
294 warn("fopen: %s", ccdconf); 295 return (1); 296 } | 296 warn("fopen: %s", ccdconf); 297 return (1); 298 } |
297 setegid(egid); | 299 if (setegid(egid) != 0) 300 err(1, "setegid failed"); |
298 299 while (fgets(line, sizeof(line), f) != NULL) { 300 argc = 0; 301 argv = NULL; 302 ++lineno; 303 if ((cp = strrchr(line, '\n')) != NULL) 304 *cp = '\0'; 305 --- 143 unchanged lines hidden --- | 301 302 while (fgets(line, sizeof(line), f) != NULL) { 303 argc = 0; 304 argv = NULL; 305 ++lineno; 306 if ((cp = strrchr(line, '\n')) != NULL) 307 *cp = '\0'; 308 --- 143 unchanged lines hidden --- |