From owner-svn-src-head@freebsd.org Wed Jan 3 07:43:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A940EB2222; Wed, 3 Jan 2018 07:43:05 +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 mx1.freebsd.org (Postfix) with ESMTPS id 468CD68849; Wed, 3 Jan 2018 07:43:05 +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 w037h4UC030524; Wed, 3 Jan 2018 07:43:04 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w037h4Lq030523; Wed, 3 Jan 2018 07:43:04 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201801030743.w037h4Lq030523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Wed, 3 Jan 2018 07:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r327513 - head/usr.bin/kdump X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/usr.bin/kdump X-SVN-Commit-Revision: 327513 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 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: Wed, 03 Jan 2018 07:43:05 -0000 Author: oshogbo Date: Wed Jan 3 07:43:04 2018 New Revision: 327513 URL: https://svnweb.freebsd.org/changeset/base/327513 Log: NLS data and tz can be cached using caspicum helpers. Using them we simplifies and unifies sandboxed code. Modified: head/usr.bin/kdump/kdump.c Modified: head/usr.bin/kdump/kdump.c ============================================================================== --- head/usr.bin/kdump/kdump.c Wed Jan 3 06:41:39 2018 (r327512) +++ head/usr.bin/kdump/kdump.c Wed Jan 3 07:43:04 2018 (r327513) @@ -175,34 +175,7 @@ static TAILQ_HEAD(trace_procs, proc_info) trace_procs; #ifdef WITH_CASPER static cap_channel_t *cappwd, *capgrp; -#endif -static void -strerror_init(void) -{ - - /* - * Cache NLS data before entering capability mode. - * XXXPJD: There should be strerror_init() and strsignal_init() in libc. - */ - (void)catopen("libc", NL_CAT_LOCALE); -} - -static void -localtime_init(void) -{ - time_t ltime; - - /* - * Allow localtime(3) to cache /etc/localtime content before entering - * capability mode. - * XXXPJD: There should be localtime_init() in libc. - */ - (void)time(<ime); - (void)localtime(<ime); -} - -#ifdef WITH_CASPER static int cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp) { @@ -450,8 +423,9 @@ main(int argc, char *argv[]) if (!freopen(tracefile, "r", stdin)) err(1, "%s", tracefile); - strerror_init(); - localtime_init(); + caph_cache_catpages(); + caph_cache_tzdata(); + #ifdef WITH_CASPER if (resolv != 0) { if (cappwdgrp_setup(&cappwd, &capgrp) < 0) {