Merge "Make fclose/pclose distinct."
diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp
index 71fdd27..d7b69dc 100644
--- a/libc/stdio/stdio.cpp
+++ b/libc/stdio/stdio.cpp
@@ -404,8 +404,7 @@
}
__strong_alias(freopen64, freopen);
-int fclose(FILE* fp) {
- CHECK_FP(fp);
+static int __FILE_close(FILE* fp) {
if (fp->_flags == 0) {
// Already freed!
errno = EBADF;
@@ -440,7 +439,11 @@
fp->_flags = 0;
return r;
}
-__strong_alias(pclose, fclose);
+
+int fclose(FILE* fp) {
+ CHECK_FP(fp);
+ return __FILE_close(fp);
+}
int fileno_unlocked(FILE* fp) {
CHECK_FP(fp);
@@ -459,6 +462,7 @@
}
void clearerr_unlocked(FILE* fp) {
+ CHECK_FP(fp);
return __sclearerr(fp);
}
@@ -1235,6 +1239,11 @@
return fp;
}
+int pclose(FILE* fp) {
+ CHECK_FP(fp);
+ return __FILE_close(fp);
+}
+
namespace {
namespace phony {