Deleted Added
full compact
daemon.c (256281) daemon.c (265781)
1/*-
2 * Copyright (c) 1999 Berkeley Software Design, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * From BSDI: daemon.c,v 1.2 1996/08/15 01:11:09 jch Exp
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1999 Berkeley Software Design, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

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

24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * From BSDI: daemon.c,v 1.2 1996/08/15 01:11:09 jch Exp
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: stable/10/usr.sbin/daemon/daemon.c 255707 2013-09-19 18:00:05Z trociny $");
32__FBSDID("$FreeBSD: stable/10/usr.sbin/daemon/daemon.c 265781 2014-05-09 15:55:45Z jh $");
33
34#include <sys/param.h>
35#include <sys/mman.h>
36#include <sys/wait.h>
37
38#include <err.h>
39#include <errno.h>
40#include <libutil.h>

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

134 * executes the command in a forked process and wait on child
135 * exit to remove the pidfile or restart the command. Normally
136 * we don't want the monitoring daemon to be terminated
137 * leaving the running process and the stale pidfile, so we
138 * catch SIGTERM and forward it to the children expecting to
139 * get SIGCHLD eventually.
140 */
141 pid = -1;
33
34#include <sys/param.h>
35#include <sys/mman.h>
36#include <sys/wait.h>
37
38#include <err.h>
39#include <errno.h>
40#include <libutil.h>

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

134 * executes the command in a forked process and wait on child
135 * exit to remove the pidfile or restart the command. Normally
136 * we don't want the monitoring daemon to be terminated
137 * leaving the running process and the stale pidfile, so we
138 * catch SIGTERM and forward it to the children expecting to
139 * get SIGCHLD eventually.
140 */
141 pid = -1;
142 if (pidfile != NULL || restart) {
142 if (pidfile != NULL || ppidfile != NULL || restart) {
143 /*
144 * Restore default action for SIGTERM in case the
145 * parent process decided to ignore it.
146 */
147 if (signal(SIGTERM, SIG_DFL) == SIG_ERR) {
148 warn("signal");
149 goto exit;
150 }

--- 126 unchanged lines hidden ---
143 /*
144 * Restore default action for SIGTERM in case the
145 * parent process decided to ignore it.
146 */
147 if (signal(SIGTERM, SIG_DFL) == SIG_ERR) {
148 warn("signal");
149 goto exit;
150 }

--- 126 unchanged lines hidden ---