mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
LibC: Fix missing '\n' at the end of ctime/ctime_r/asctime/asctime_r
@linusg noticed this bug in the original implementation during code review. This makes all of these API's more spec conforming.
This commit is contained in:
parent
440b81deba
commit
df808f0ed3
1 changed files with 5 additions and 1 deletions
|
@ -193,7 +193,11 @@ char* asctime_r(const struct tm* tm, char* buffer)
|
||||||
{
|
{
|
||||||
// Spec states buffer must be at least 26 bytes.
|
// Spec states buffer must be at least 26 bytes.
|
||||||
constexpr size_t assumed_len = 26;
|
constexpr size_t assumed_len = 26;
|
||||||
strftime(buffer, assumed_len, "%a %b %e %T %Y", tm);
|
size_t filled_size = strftime(buffer, assumed_len, "%a %b %e %T %Y\n", tm);
|
||||||
|
|
||||||
|
// Verify that the buffer was large enough.
|
||||||
|
VERIFY(filled_size != 0);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue