From owner-svn-src-head@freebsd.org Sat Jan 26 14:10:50 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8176D14C46FF; Sat, 26 Jan 2019 14:10:50 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 295D384ABC; Sat, 26 Jan 2019 14:10:50 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E0D421128; Sat, 26 Jan 2019 14:10:50 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0QEAow4072729; Sat, 26 Jan 2019 14:10:50 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0QEAnuG072726; Sat, 26 Jan 2019 14:10:49 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201901261410.x0QEAnuG072726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 26 Jan 2019 14:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r343471 - head/lib/libcasper/libcasper X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/lib/libcasper/libcasper X-SVN-Commit-Revision: 343471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 295D384ABC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jan 2019 14:10:50 -0000 Author: oshogbo Date: Sat Jan 26 14:10:49 2019 New Revision: 343471 URL: https://svnweb.freebsd.org/changeset/base/343471 Log: 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 Modified: head/lib/libcasper/libcasper/libcasper_service.c head/lib/libcasper/libcasper/service.c head/lib/libcasper/libcasper/zygote.c Modified: head/lib/libcasper/libcasper/libcasper_service.c ============================================================================== --- head/lib/libcasper/libcasper/libcasper_service.c Sat Jan 26 13:53:00 2019 (r343470) +++ head/lib/libcasper/libcasper/libcasper_service.c Sat Jan 26 14:10:49 2019 (r343471) @@ -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) { Modified: head/lib/libcasper/libcasper/service.c ============================================================================== --- head/lib/libcasper/libcasper/service.c Sat Jan 26 13:53:00 2019 (r343470) +++ head/lib/libcasper/libcasper/service.c Sat Jan 26 14:10:49 2019 (r343471) @@ -427,7 +427,7 @@ service_start(struct service *service, int sock, int p 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 p 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 p } } - exit(0); + _exit(0); } Modified: head/lib/libcasper/libcasper/zygote.c ============================================================================== --- head/lib/libcasper/libcasper/zygote.c Sat Jan 26 13:53:00 2019 (r343470) +++ head/lib/libcasper/libcasper/zygote.c Sat Jan 26 14:10:49 2019 (r343471) @@ -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]);