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 <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2020-12-29 00:00:00 -06:00 committed by Craig Small
parent 649e45482f
commit a0aed7b3df

View File

@ -3209,16 +3209,17 @@ static void before (char *me) {
atexit(close_stdout); atexit(close_stdout);
// is /proc mounted?
fatal_proc_unmounted(NULL, 0);
// setup our program name // setup our program name
Myname = strrchr(me, '/'); Myname = strrchr(me, '/');
if (Myname) ++Myname; else Myname = me; if (Myname) ++Myname; else Myname = me;
// accommodate nls/gettext potential translations // accommodate nls/gettext potential translations
// ( must 'setlocale' before our libproc called )
initialize_nls(); initialize_nls();
// is /proc mounted?
fatal_proc_unmounted(NULL, 0);
#ifndef OFF_STDERROR #ifndef OFF_STDERROR
/* there's a chance that damn libnuma may spew to stderr so we gotta /* 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! make sure he does not corrupt poor ol' top's first output screen!