summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/proc.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2015-11-22 13:27:14 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2015-11-22 13:27:14 +0000
commitae00fbc8a4af662a3b1361075ec3b2936485b844 (patch)
tree0cd66f8f60cb1ab7408bbb02fea2efa55d935312 /usr.sbin/httpd/proc.c
parentf06a2f825b72cc678ad244ed598777a44190f891 (diff)
Update log.c: change fatal() and fatalx() into variadic functions,
include the process name, and replace all calls of fatal*(NULL) with fatal(__func__) for better debugging. OK benno@
Diffstat (limited to 'usr.sbin/httpd/proc.c')
-rw-r--r--usr.sbin/httpd/proc.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/httpd/proc.c b/usr.sbin/httpd/proc.c
index 9ba7bbefe6d..8d25801b1e7 100644
--- a/usr.sbin/httpd/proc.c
+++ b/usr.sbin/httpd/proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: proc.c,v 1.9 2015/08/20 13:00:23 reyk Exp $ */
+/* $OpenBSD: proc.c,v 1.10 2015/11/22 13:27:13 reyk Exp $ */
/*
* Copyright (c) 2010 - 2014 Reyk Floeter <reyk@openbsd.org>
@@ -346,6 +346,8 @@ proc_run(struct privsep *ps, struct privsep_proc *p,
case -1:
fatal("proc_run: cannot fork");
case 0:
+ log_procinit(p->p_title);
+
/* Set the process group of the current process */
setpgid(0, 0);
break;
@@ -357,10 +359,10 @@ proc_run(struct privsep *ps, struct privsep_proc *p,
if (p->p_id == PROC_CONTROL && ps->ps_instance == 0) {
if (control_init(ps, &ps->ps_csock) == -1)
- fatalx(p->p_title);
+ fatalx(__func__);
TAILQ_FOREACH(rcs, &ps->ps_rcsocks, cs_entry)
if (control_init(ps, rcs) == -1)
- fatalx(p->p_title);
+ fatalx(__func__);
}
/* Change root directory */
@@ -417,10 +419,10 @@ proc_run(struct privsep *ps, struct privsep_proc *p,
if (p->p_id == PROC_CONTROL && ps->ps_instance == 0) {
TAILQ_INIT(&ctl_conns);
if (control_listen(&ps->ps_csock) == -1)
- fatalx(p->p_title);
+ fatalx(__func__);
TAILQ_FOREACH(rcs, &ps->ps_rcsocks, cs_entry)
if (control_listen(rcs) == -1)
- fatalx(p->p_title);
+ fatalx(__func__);
}
if (init != NULL)
@@ -450,7 +452,7 @@ proc_dispatch(int fd, short event, void *arg)
if (event & EV_READ) {
if ((n = imsg_read(ibuf)) == -1)
- fatal(title);
+ fatal(__func__);
if (n == 0) {
/* this pipe is dead, so remove the event handler */
event_del(&iev->ev);
@@ -461,12 +463,12 @@ proc_dispatch(int fd, short event, void *arg)
if (event & EV_WRITE) {
if (msgbuf_write(&ibuf->w) <= 0 && errno != EAGAIN)
- fatal(title);
+ fatal(__func__);
}
for (;;) {
if ((n = imsg_get(ibuf, &imsg)) == -1)
- fatal(title);
+ fatal(__func__);
if (n == 0)
break;
@@ -498,7 +500,7 @@ proc_dispatch(int fd, short event, void *arg)
log_warnx("%s: %s %d got invalid imsg %d from %s %d",
__func__, title, ps->ps_instance + 1,
imsg.hdr.type, p->p_title, p->p_instance);
- fatalx(title);
+ fatalx(__func__);
}
imsg_free(&imsg);
}