Skip to content

Commit

Permalink
libc/puts: newline was omitted for empty string
Browse files Browse the repository at this point in the history
`puts("");` did not print a newline. The standard
behavior is to print a newline even if the string
is empty.

Signed-off-by: liamHowatt <[email protected]>
  • Loading branch information
liamHowatt authored and xiaoxiang781216 committed Dec 1, 2024
1 parent 6135892 commit 0bdc9d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/libc/stdio/lib_puts.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ int puts(FAR const IPTR char *s)
/* Write the string without its trailing '\0' */

nwritten = fputs_unlocked(s, stream);
if (nwritten > 0)
if (nwritten >= 0)
{
/* Followed by a newline */

Expand Down

0 comments on commit 0bdc9d2

Please sign in to comment.