summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gunnar@beutner.name>2021-04-12 18:29:36 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-12 22:34:07 +0200
commit04979865722ab558fdc4d909dbb9cecd40869897 (patch)
tree363beb5e1b30cf76cf459572fadf870ab18d93b3
parent44486e881892d2d59591cf9943c20e4265c6442a (diff)
downloadserenity-04979865722ab558fdc4d909dbb9cecd40869897.zip
LibC: Use dbgln() in strerror() and strsignal()
Printing error messages to stdout can have unintended side effects depending on what the program is doing.
-rw-r--r--Userland/Libraries/LibC/string.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/string.cpp b/Userland/Libraries/LibC/string.cpp
index 596e04c95e..cd7af7554f 100644
--- a/Userland/Libraries/LibC/string.cpp
+++ b/Userland/Libraries/LibC/string.cpp
@@ -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]);