svn commit: r343984 - stable/12/lib/libcasper/libcasper

Mariusz Zaborski oshogbo at FreeBSD.org
Sun Feb 10 22:33:42 UTC 2019


Author: oshogbo
Date: Sun Feb 10 22:33:41 2019
New Revision: 343984
URL: https://svnweb.freebsd.org/changeset/base/343984

Log:
  MFC r343471:
    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:
  stable/12/lib/libcasper/libcasper/libcasper_service.c
  stable/12/lib/libcasper/libcasper/service.c
  stable/12/lib/libcasper/libcasper/zygote.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libcasper/libcasper/libcasper_service.c
==============================================================================
--- stable/12/lib/libcasper/libcasper/libcasper_service.c	Sun Feb 10 22:32:09 2019	(r343983)
+++ stable/12/lib/libcasper/libcasper/libcasper_service.c	Sun Feb 10 22:33:41 2019	(r343984)
@@ -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: stable/12/lib/libcasper/libcasper/service.c
==============================================================================
--- stable/12/lib/libcasper/libcasper/service.c	Sun Feb 10 22:32:09 2019	(r343983)
+++ stable/12/lib/libcasper/libcasper/service.c	Sun Feb 10 22:33:41 2019	(r343984)
@@ -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: stable/12/lib/libcasper/libcasper/zygote.c
==============================================================================
--- stable/12/lib/libcasper/libcasper/zygote.c	Sun Feb 10 22:32:09 2019	(r343983)
+++ stable/12/lib/libcasper/libcasper/zygote.c	Sun Feb 10 22:33:41 2019	(r343984)
@@ -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]);


More information about the svn-src-stable mailing list