mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibC: Use dbgln() in strerror() and strsignal()
Printing error messages to stdout can have unintended side effects depending on what the program is doing.
This commit is contained in:
parent
44486e8818
commit
0497986572
Notes:
sideshowbarker
2024-07-18 20:27:59 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/04979865722 Pull-request: https://github.com/SerenityOS/serenity/pull/6275
1 changed files with 3 additions and 2 deletions
|
@ -24,6 +24,7 @@
|
|||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/MemMem.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
|
@ -376,7 +377,7 @@ int sys_nerr = EMAXERRNO;
|
|||
char* strerror(int errnum)
|
||||
{
|
||||
if (errnum < 0 || errnum >= EMAXERRNO) {
|
||||
printf("strerror() missing string for errnum=%d\n", errnum);
|
||||
dbgln("strerror() missing string for errnum={}", errnum);
|
||||
return const_cast<char*>("Unknown error");
|
||||
}
|
||||
return const_cast<char*>(sys_errlist[errnum]);
|
||||
|
@ -385,7 +386,7 @@ char* strerror(int errnum)
|
|||
char* strsignal(int signum)
|
||||
{
|
||||
if (signum >= NSIG) {
|
||||
printf("strsignal() missing string for signum=%d\n", signum);
|
||||
dbgln("strsignal() missing string for signum={}", signum);
|
||||
return const_cast<char*>("Unknown signal");
|
||||
}
|
||||
return const_cast<char*>(sys_siglist[signum]);
|
||||
|
|
Loading…
Reference in a new issue