Skip to content

Commit 0631168

Browse files
committed
remove the error code from the error message.
1 parent a6cc742 commit 0631168

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed

system/lib/libc/musl/src/errno/strerror.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ char *__strerror_l(int e, locale_t loc)
3636
#endif
3737
#ifdef __EMSCRIPTEN__
3838
if (e < 0 || e >= sizeof errmsgidx / sizeof *errmsgidx || (e != 0 && !errmsgidx[e])) {
39-
static char buf[32];
40-
snprintf(buf, sizeof buf, "Unknown error %d", e);
41-
return buf;
39+
return "Unknown error";
4240
}
4341
s = (char *)&errmsgstr + errmsgidx[e];
4442
// strerror is a (debug) dependency of many emscripten syscalls which mean it

test/test_core.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6169,10 +6169,6 @@ def test_unistd_curdir(self):
61696169
def test_unistd_close(self):
61706170
self.do_run_in_out_file_test('unistd/close.c')
61716171

6172-
@also_with_noderawfs
6173-
def test_unistd_errno(self):
6174-
self.do_run_in_out_file_test('unistd/errno.c')
6175-
61766172
def test_unistd_fsync_stdout(self):
61776173
self.do_run_in_out_file_test('unistd/fsync_stdout.c')
61786174

test/test_other.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13124,6 +13124,9 @@ def test_wasmfs_before_preload(self):
1312413124
def test_hello_world_above_2gb(self):
1312513125
self.do_run_in_out_file_test('hello_world.c', cflags=['-sGLOBAL_BASE=2GB', '-sINITIAL_MEMORY=3GB'])
1312613126

13127+
def test_unistd_strerror(self):
13128+
self.do_run_in_out_file_test('unistd/strerror.c')
13129+
1312713130
def test_hello_function(self):
1312813131
# hello_function.cpp is referenced/used in the docs. This test ensures that it
1312913132
# at least compiles.

test/unistd/errno.out

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
/*
2-
* Copyright 2011 The Emscripten Authors. All rights reserved.
2+
* Copyright 2025 The Emscripten Authors. All rights reserved.
33
* Emscripten is available under two separate licenses, the MIT license and the
44
* University of Illinois/NCSA Open Source License. Both these licenses can be
55
* found in the LICENSE file.
66
*/
77

88
#include <stdio.h>
99
#include <string.h>
10-
#include <errno.h>
11-
#include <unistd.h>
12-
#include <emscripten.h>
1310

1411
int main() {
15-
int error = -1;
16-
printf("errno: %s\n", strerror(error));
12+
printf("errno: %s\n", strerror(-1));
1713
}

test/unistd/strerror.out

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
errno: Unknown error

0 commit comments

Comments
 (0)