Permalink
Browse files

Handle fflush(NULL) properly

  • Loading branch information...
1 parent 01472d7 commit 49c5cccf290f2a310beb360aaeb2b460fc7cb62f @shinh committed Apr 2, 2012
Showing with 7 additions and 0 deletions.
  1. +2 −0 libmac/mac.c
  2. +5 −0 mach/fflush_null.c
View
2 libmac/mac.c
@@ -644,6 +644,8 @@ int __darwin_vfprintf(__darwin_FILE* fp, const char* fmt, va_list ap) {
}
int __darwin_fflush(__darwin_FILE* fp) {
+ if (!fp)
+ return fflush(NULL);
return fflush(fp->linux_fp);
}
View
5 mach/fflush_null.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+int main() {
+ return fflush(NULL);
+}

0 comments on commit 49c5ccc

Please sign in to comment.