Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Jan 2019 14:10:49 +0000 (UTC)
From:      Mariusz Zaborski <oshogbo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343471 - head/lib/libcasper/libcasper
Message-ID:  <201901261410.x0QEAnuG072726@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901261410.x0QEAnuG072726>