View | Details | Raw Unified | Return to bug 217924
Collapse All | Expand All

(-)b/sbin/dhclient/dhclient.c (-1 / +1 lines)
Lines 2368-2408 dhcp_option_ev_name(char *buf, size_t buflen, struct option *option) Link Here
2368
	}
2368
	}
2369
2369
2370
	buf[i] = 0;
2370
	buf[i] = 0;
2371
	return 1;
2371
	return 1;
2372
}
2372
}
2373
2373
2374
void
2374
void
2375
go_daemon(void)
2375
go_daemon(void)
2376
{
2376
{
2377
	static int state = 0;
2377
	static int state = 0;
2378
	cap_rights_t rights;
2378
	cap_rights_t rights;
2379
2379
2380
	if (no_daemon || state)
2380
	if (no_daemon || state)
2381
		return;
2381
		return;
2382
2382
2383
	state = 1;
2383
	state = 1;
2384
2384
2385
	/* Stop logging to stderr... */
2385
	/* Stop logging to stderr... */
2386
	log_perror = 0;
2386
	log_perror = 0;
2387
2387
2388
	if (daemon(1, 0) == -1)
2388
	if (daemon(1, 1) == -1)
2389
		error("daemon");
2389
		error("daemon");
2390
2390
2391
	cap_rights_init(&rights);
2391
	cap_rights_init(&rights);
2392
2392
2393
	if (pidfile != NULL) {
2393
	if (pidfile != NULL) {
2394
		pidfile_write(pidfile);
2394
		pidfile_write(pidfile);
2395
		if (cap_rights_limit(pidfile_fileno(pidfile), &rights) < 0 &&
2395
		if (cap_rights_limit(pidfile_fileno(pidfile), &rights) < 0 &&
2396
		    errno != ENOSYS) {
2396
		    errno != ENOSYS) {
2397
			error("can't limit pidfile descriptor: %m");
2397
			error("can't limit pidfile descriptor: %m");
2398
		}
2398
		}
2399
	}
2399
	}
2400
2400
2401
	/* we are chrooted, daemon(3) fails to open /dev/null */
2401
	/* we are chrooted, daemon(3) fails to open /dev/null */
2402
	if (nullfd != -1) {
2402
	if (nullfd != -1) {
2403
		dup2(nullfd, STDIN_FILENO);
2403
		dup2(nullfd, STDIN_FILENO);
2404
		dup2(nullfd, STDOUT_FILENO);
2404
		dup2(nullfd, STDOUT_FILENO);
2405
		dup2(nullfd, STDERR_FILENO);
2405
		dup2(nullfd, STDERR_FILENO);
2406
		close(nullfd);
2406
		close(nullfd);
2407
		nullfd = -1;
2407
		nullfd = -1;
2408
	}
2408
	}

Return to bug 217924