Skip to content

Commit c1c3fc5

Browse files
committed
Add #ifdef, comment, and update libc readme
1 parent 5468973 commit c1c3fc5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

system/lib/libc/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Some changes have been made to the version that was taken from upstream, includi
1212
* Switch to using the wasi `fd_write` syscall instead of `writev`.
1313
* Simplify stdout stream handling: do not support seeking, terminal handling, etc., as it just increases code size and Emscripten doesn't have those features anyhow.
1414
* Setting `_POSIX_REALTIME_SIGNALS` and `_POSIX_SPAWN` macros to -1, to exclude unsupported functions.
15+
* Handling trailing % in `strftime` and `wcsftime` format strings.
1516

1617
Copy log.c and log2.c from earlier version of musl which result in smaller
1718
binary size since they do not rely data tables in log_data.c and log2_data.c.

system/lib/libc/musl/src/time/strftime.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,13 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
226226
s[l] = 0;
227227
return l;
228228
}
229+
#ifdef __EMSCRIPTEN__
230+
// Handle trailing % by outputting a % rather than returning 0. Ideally
231+
// this 6 character change could be upstreamed into musl...
229232
if (*f != '%' || !f[1]) {
233+
#else
234+
if (*f != '%') {
235+
#endif
230236
s[l++] = *f;
231237
continue;
232238
}

0 commit comments

Comments
 (0)