From 4f7d48aa24b20f92b3cd9438a446e345b849c39b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 2 Dec 2020 18:08:53 +0100 Subject: Set locale only once and do not override it later --- htop.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'htop.c') diff --git a/htop.c b/htop.c index 41ef155e..23da0815 100644 --- a/htop.c +++ b/htop.c @@ -262,10 +262,9 @@ static void setCommFilter(State* state, char** commFilter) { int main(int argc, char** argv) { - char *lc_ctype = getenv("LC_CTYPE"); - if (lc_ctype != NULL) - setlocale(LC_CTYPE, lc_ctype); - else if ((lc_ctype = getenv("LC_ALL"))) + /* initialize locale */ + const char* lc_ctype; + if ((lc_ctype = getenv("LC_CTYPE")) || (lc_ctype = getenv("LC_ALL"))) setlocale(LC_CTYPE, lc_ctype); else setlocale(LC_CTYPE, ""); -- cgit v1.2.3