浏览代码

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

Andreas Kling 6 年之前
父节点
当前提交
1483af406f
共有 1 个文件被更改,包括 5 次插入2 次删除
  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)