libcasper: do not run registered exit functions

Casper library should not use exit(3) function because before setting it up
applications may register it. Casper doesn't depend on any registered exit
function, so it safe to change this.

Reported by:	jceel
MFC after:	2 weeks
This commit is contained in:
Mariusz Zaborski 2019-01-26 14:10:49 +00:00
parent db009dddfd
commit 28f4385e45
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=343471
3 changed files with 13 additions and 13 deletions

View File

@ -148,20 +148,20 @@ service_execute(int chanfd)
nvl = nvlist_recv(chanfd, 0);
if (nvl == NULL)
exit(1);
_exit(1);
if (!nvlist_exists_string(nvl, "service"))
exit(1);
_exit(1);
servname = nvlist_get_string(nvl, "service");
casserv = service_find(servname);
if (casserv == NULL)
exit(1);
_exit(1);
service = casserv->cs_service;
procfd = nvlist_take_descriptor(nvl, "procfd");
nvlist_destroy(nvl);
service_start(service, chanfd, procfd);
/* Not reached. */
exit(1);
_exit(1);
}
static int
@ -231,7 +231,7 @@ casper_main_loop(int fd)
int sock, maxfd, ret;
if (zygote_init() < 0)
exit(1);
_exit(1);
/*
* Register core services.
@ -256,7 +256,7 @@ casper_main_loop(int fd)
}
if (maxfd == -1) {
/* Nothing to do. */
exit(0);
_exit(0);
}
maxfd++;
@ -267,7 +267,7 @@ casper_main_loop(int fd)
if (ret == -1) {
if (errno == EINTR)
continue;
exit(1);
_exit(1);
}
TAILQ_FOREACH(casserv, &casper_services, cs_next) {

View File

@ -427,7 +427,7 @@ service_start(struct service *service, int sock, int procfd)
service_clean(sock, procfd, service->s_flags);
if (service_connection_add(service, sock, NULL) == NULL)
exit(1);
_exit(1);
for (;;) {
FD_ZERO(&fds);
@ -443,7 +443,7 @@ service_start(struct service *service, int sock, int procfd)
nfds = select(maxfd + 1, &fds, NULL, NULL, NULL);
if (nfds < 0) {
if (errno != EINTR)
exit(1);
_exit(1);
continue;
} else if (nfds == 0) {
/* Timeout. */
@ -468,5 +468,5 @@ service_start(struct service *service, int sock, int procfd)
}
}
exit(0);
_exit(0);
}

View File

@ -122,7 +122,7 @@ zygote_main(int sock)
if (nvlin == NULL) {
if (errno == ENOTCONN) {
/* Casper exited. */
exit(0);
_exit(0);
}
continue;
}
@ -134,7 +134,7 @@ zygote_main(int sock)
func = service_execute;
break;
default:
exit(0);
_exit(0);
}
/*
@ -161,7 +161,7 @@ zygote_main(int sock)
close(chanfd[0]);
func(chanfd[1]);
/* NOTREACHED */
exit(1);
_exit(1);
default:
/* Parent. */
close(chanfd[1]);