From 6368834a09f18a4dd4f5e87f2e7989f33f58e176 Mon Sep 17 00:00:00 2001 From: liamHowatt Date: Sat, 30 Nov 2024 13:38:04 +0000 Subject: [PATCH] libc/puts: newline was omitted for empty string `puts("");` did not print a newline. The standard behavior is to print a newline even if the string is empty. Signed-off-by: liamHowatt --- libs/libc/stdio/lib_puts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/libc/stdio/lib_puts.c b/libs/libc/stdio/lib_puts.c index b51a5a83942be..8e57f888e7c86 100644 --- a/libs/libc/stdio/lib_puts.c +++ b/libs/libc/stdio/lib_puts.c @@ -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 */