Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Sep 2013 18:28:03 GMT
From:      dpl@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r256905 - soc2013/dpl/head/lib/libzcap
Message-ID:  <201309041828.r84IS3G5060611@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dpl
Date: Wed Sep  4 18:28:03 2013
New Revision: 256905
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=256905

Log:
  Now the creation of sandbox makes more sense.
  

Modified:
  soc2013/dpl/head/lib/libzcap/capsicum.c

Modified: soc2013/dpl/head/lib/libzcap/capsicum.c
==============================================================================
--- soc2013/dpl/head/lib/libzcap/capsicum.c	Wed Sep  4 18:26:30 2013	(r256904)
+++ soc2013/dpl/head/lib/libzcap/capsicum.c	Wed Sep  4 18:28:03 2013	(r256905)
@@ -86,26 +86,16 @@
 
 /*
  * This function should be called only by:
- *	- gzopen()
- *	- deflateInit()
- *	- inflateInit()
+ * gzopen(), deflateInit(), inflateInit(),
+ * inflateBackInit().
  */
 struct sandbox *
 startSandbox(void *data)
 {
 	struct sandbox *newsandbox;
 
-	if (!slist_initiated) {
-		SLIST_INIT(&sandboxes);
-		slist_initiated = 1;
-	}
-
-	/* Here we add a sandbox used for non-structure related stuff */
-	/* This will be the first sandbox always */
-	if (SLIST_EMPTY(&sandboxes)) {
-		newsandbox = startChild(newsandbox, NULL);
-		SLIST_INSERT_HEAD(&sandboxes, newsandbox, entries);
-	}
+	if (!slist_initiated)
+		startNullSandbox();
 
 	/* Create and add the real sandbox */
 	newsandbox = startChild(data);
@@ -114,9 +104,26 @@
 	return (newsandbox);
 }
 
+void
+startNullSandbox(void)
+{
+	if (!slist_initiated) {
+		SLIST_INIT(&sandboxes);
+
+		/* Here we add a sandbox used for non-structure related stuff */
+		/* This will be the first sandbox always */
+		if (SLIST_EMPTY(&sandboxes)) {
+			newsandbox = startChild(newsandbox, NULL);
+			SLIST_INSERT_HEAD(&sandboxes, newsandbox, entries);
+		}
+	}
+	slist_initiated = 1;
+}
+
 /*
- * Kills the sandbox, and deletes
- * the associated struct sandbox.
+ * Kills the sandbox, and deletes the associated 
+ * struct sandbox. Should be called by: gzclose,
+ * deflateEnd, inflateEnd (inflateBackEnd).
  */
 int
 stopSandbox(struct sandbox *sandbox)
@@ -140,7 +147,7 @@
  * Returns NULL if not found.
  */
 struct sandbox *
-findsanbox(void *ptr)
+findsandbox(void *ptr)
 {
 	struct sandbox *sandbox;
 



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