Browse Source

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

Andreas Kling 6 năm trước cách đây
mục cha
commit
1483af406f
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  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)