From a0aed7b3dfd0fac35c67d228f42d8c1fae564d76 Mon Sep 17 00:00:00 2001 From: Jim Warner Date: Tue, 29 Dec 2020 00:00:00 -0600 Subject: [PATCH] top: relocate the 'fatal_proc_unmounted' function call With the restoration of corrupt utf8 multibyte editing to the library, it's important to establish the proper locale before calling that 'fatal_proc_unmounted' guy. He calls the original 'look_up_our_self' who, in turn, will invoke 'stat2proc' which then calls 'escape_str'. Once there, it's too late to effect changes to locale. [ the result would be lots and lots of '?' displayed ] Signed-off-by: Jim Warner --- top/top.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/top/top.c b/top/top.c index 7da896b0..a2054f83 100644 --- a/top/top.c +++ b/top/top.c @@ -3209,16 +3209,17 @@ static void before (char *me) { atexit(close_stdout); - // is /proc mounted? - fatal_proc_unmounted(NULL, 0); - // setup our program name Myname = strrchr(me, '/'); if (Myname) ++Myname; else Myname = me; // accommodate nls/gettext potential translations + // ( must 'setlocale' before our libproc called ) initialize_nls(); + // is /proc mounted? + fatal_proc_unmounted(NULL, 0); + #ifndef OFF_STDERROR /* there's a chance that damn libnuma may spew to stderr so we gotta make sure he does not corrupt poor ol' top's first output screen!