svn commit: trunk/uClibc/test/stdio
vapier at uclibc.org
vapier at uclibc.org
Mon Feb 5 01:17:10 UTC 2007
Author: vapier
Date: 2007-02-04 17:17:09 -0800 (Sun, 04 Feb 2007)
New Revision: 17775
Log:
new cheesy test by Denis Vlasenko to trigger fclose loop
Added:
trunk/uClibc/test/stdio/fclose-loop.c
Modified:
trunk/uClibc/test/stdio/
Changeset:
Property changes on: trunk/uClibc/test/stdio
___________________________________________________________________
Name: svn:ignore
- 64bit
*_glibc
*.gdb
*.out
+ 64bit
fclose-loop
*_glibc
*.gdb
*.out
Added: trunk/uClibc/test/stdio/fclose-loop.c
===================================================================
--- trunk/uClibc/test/stdio/fclose-loop.c (rev 0)
+++ trunk/uClibc/test/stdio/fclose-loop.c 2007-02-05 01:17:09 UTC (rev 17775)
@@ -0,0 +1,21 @@
+/* From: Denis Vlasenko <vda.linux at googlemail.com>
+ * With certain combination of .config options fclose() does not
+ * remove FILE* pointer from _stdio_openlist. As a result, subsequent
+ * fopen() may allocate new FILE structure exactly in place of one
+ * freed by previous fclose(), which then makes _stdio_openlist
+ * circularlt looped. The following program will enter infinite loop
+ * trying to walk _stdio_openlist in exit():
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ FILE* fp;
+ fp = fopen("/dev/null", "r");
+ fclose(fp);
+ fp = fopen("/dev/zero", "r");
+ fclose(fp);
+ return 0;
+}
More information about the uClibc-cvs
mailing list