diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2011-04-03 21:11:28 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2011-04-03 21:11:28 +0000 |
commit | 2357b4ca6f82083e9d2c1f937c45570e4817d7dc (patch) | |
tree | 4093a25becf8df8af867483097c5d796aa5298de /usr.sbin | |
parent | 7e8e7dd2507c9a05dbe828056d9e072121a91404 (diff) |
Call setlocale() to avoid display glitches in UTF-8 locales.
ok phessler nicm mikeb
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/tcpdump/privsep.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/tcpdump/privsep.c b/usr.sbin/tcpdump/privsep.c index 9e9f6376655..cf428abbfe8 100644 --- a/usr.sbin/tcpdump/privsep.c +++ b/usr.sbin/tcpdump/privsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep.c,v 1.28 2009/04/17 22:31:24 jmc Exp $ */ +/* $OpenBSD: privsep.c,v 1.29 2011/04/03 21:11:27 stsp Exp $ */ /* * Copyright (c) 2003 Can Erkin Acar @@ -32,6 +32,7 @@ #include <err.h> #include <errno.h> #include <fcntl.h> +#include <locale.h> #include <netdb.h> #include <paths.h> #include <pwd.h> @@ -162,6 +163,9 @@ priv_init(int argc, char **argv) if (pw == NULL) errx(1, "unknown user _tcpdump"); + /* set the locale before chrooting */ + (void)setlocale(LC_CTYPE, ""); + /* chroot, drop privs and return */ if (chroot(pw->pw_dir) != 0) err(1, "unable to chroot"); |