Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion system/lib/libc/musl/src/time/strftime.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
s[l] = 0;
return l;
}
if (*f != '%') {
if (*f != '%' || !f[1]) {
s[l++] = *f;
continue;
}
Expand Down
3 changes: 3 additions & 0 deletions test/other/test_strftime.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,5 +307,8 @@ int main() {
size = strftime(s, sizeof(s), "%Ec", &tm);
TEST(!cmp(s, "Mon Dec 17 00:00:00 2018"), "strftime test #36a", s);

size = strftime(s, sizeof(s), "trailing %", &tm);
TEST((size == 10), "strftime test #37", s);
TEST(!cmp(s, "trailing %"), "strftime test #37", s);
return 0;
}