aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/kdump
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2013-07-18 21:56:10 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2013-07-18 21:56:10 +0000
commite14da991ecf3c4e9dbd9e00bb6cead8485b0eea0 (patch)
tree97d59c531cfd7cb47bc9ed16c15250c7a4ec4409 /usr.bin/kdump
parent43a716a6408d2396336eac0b6d7db3a1f1ff39d3 (diff)
Notes
Diffstat (limited to 'usr.bin/kdump')
-rw-r--r--usr.bin/kdump/kdump.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 77a0caeb46d57..0f1a26b675398 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -165,6 +165,31 @@ struct proc_info
TAILQ_HEAD(trace_procs, proc_info) trace_procs;
+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(&ltime);
+ (void)localtime(&ltime);
+}
+
int
main(int argc, char *argv[])
{
@@ -236,11 +261,9 @@ main(int argc, char *argv[])
if (!freopen(tracefile, "r", stdin))
err(1, "%s", tracefile);
- /*
- * Cache NLS data before entering capability mode.
- * XXXPJD: There should be strerror_init() and strsignal_init() in libc.
- */
- (void)catopen("libc", NL_CAT_LOCALE);
+ strerror_init();
+ localtime_init();
+
if (resolv == 0) {
if (cap_enter() < 0 && errno != ENOSYS)
err(1, "unable to enter capability mode");