top: In the bye_bye function, replace fputs with the write interface.
When top calls malloc, if a signal is received, it will call sig_endpgm to process the signal. In the bye_bye function, if the -b option is enable, the Batch variable is set, the fputs function will calls malloc at the same time. The malloc function is not reentrant, so it will cause the program to crash. Signed-off-by: Shaohua Zhan <shaohua.zhan@windriver.com>
This commit is contained in:
parent
52afb3a8d3
commit
0bf15c004d
@ -571,7 +571,9 @@ static void bye_bye (const char *str) {
|
|||||||
fputs(str, stderr);
|
fputs(str, stderr);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (Batch) fputs("\n", stdout);
|
if (Batch) {
|
||||||
|
write(fileno(stdout), "\n", sizeof("\n"));
|
||||||
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
} // end: bye_bye
|
} // end: bye_bye
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user