Deleted Added
full compact
32c32
< __FBSDID("$FreeBSD: head/usr.sbin/daemon/daemon.c 244986 2013-01-03 00:49:11Z marius $");
---
> __FBSDID("$FreeBSD: head/usr.sbin/daemon/daemon.c 255521 2013-09-13 16:57:28Z jmg $");
56c56
< struct pidfh *pfh = NULL;
---
> struct pidfh *ppfh, *pfh;
59c59
< const char *pidfile, *user;
---
> const char *pidfile, *ppidfile, *user;
64,65c64,66
< pidfile = user = NULL;
< while ((ch = getopt(argc, argv, "cfp:ru:")) != -1) {
---
> ppfh = pfh = NULL;
> ppidfile = pidfile = user = NULL;
> while ((ch = getopt(argc, argv, "cfp:P:ru:")) != -1) {
75a77,79
> case 'P':
> ppidfile = optarg;
> break;
92c96
< pfh = NULL;
---
> ppfh = pfh = NULL;
106a111,122
>
> /* do same for actual daemon process */
> if (ppidfile != NULL) {
> ppfh = pidfile_open(ppidfile, 0600, &otherpid);
> if (ppfh == NULL) {
> if (errno == EEXIST) {
> errx(3, "process already running, pid: %d",
> otherpid);
> }
> err(2, "ppidfile ``%s''", ppidfile);
> }
> }
178a195,198
> /* write out parent pidfile if needed */
> if (ppidfile != NULL)
> pidfile_write(ppfh);
>
184a205
> pidfile_remove(ppfh);
243,244c264,265
< "usage: daemon [-cfr] [-p pidfile] [-u user] command "
< "arguments ...\n");
---
> "usage: daemon [-cfr] [-p child_pidfile] [-P supervisor_pidfile] "
> "[-u user]\n command arguments ...\n");