Explorar o código

LibC: fputs() shouldn't add a trailing newline, only puts().

Andreas Kling %!s(int64=6) %!d(string=hai) anos
pai
achega
1483af406f
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      LibC/stdio.cpp

+ 5 - 2
LibC/stdio.cpp

@@ -164,12 +164,15 @@ int fputs(const char* s, FILE* stream)
         if (rc == EOF)
             return EOF;
     }
-    return putc('\n', stream);
+    return 0;
 }
 
 int puts(const char* s)
 {
-    return fputs(s, stdout);
+    int rc = fputs(s, stdout);
+    if (rc < 0)
+        return rc;
+    return fputc('\n', stdout);
 }
 
 void clearerr(FILE* stream)