From owner-svn-soc-all@FreeBSD.ORG Wed Sep 4 18:28:03 2013 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9EDA7ACE for ; Wed, 4 Sep 2013 18:28:03 +0000 (UTC) (envelope-from dpl@FreeBSD.org) Received: from socsvn.freebsd.org (socsvn.freebsd.org [IPv6:2001:1900:2254:206a::50:2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 716B02A73 for ; Wed, 4 Sep 2013 18:28:03 +0000 (UTC) Received: from socsvn.freebsd.org ([127.0.1.124]) by socsvn.freebsd.org (8.14.7/8.14.7) with ESMTP id r84IS3V1060613 for ; Wed, 4 Sep 2013 18:28:03 GMT (envelope-from dpl@FreeBSD.org) Received: (from www@localhost) by socsvn.freebsd.org (8.14.7/8.14.6/Submit) id r84IS3G5060611 for svn-soc-all@FreeBSD.org; Wed, 4 Sep 2013 18:28:03 GMT (envelope-from dpl@FreeBSD.org) Date: Wed, 4 Sep 2013 18:28:03 GMT Message-Id: <201309041828.r84IS3G5060611@socsvn.freebsd.org> X-Authentication-Warning: socsvn.freebsd.org: www set sender to dpl@FreeBSD.org using -f From: dpl@FreeBSD.org To: svn-soc-all@FreeBSD.org Subject: socsvn commit: r256905 - soc2013/dpl/head/lib/libzcap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Sep 2013 18:28:03 -0000 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;