octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Infinite recursion with fopen


From: Bruno Haible
Subject: Re: Infinite recursion with fopen
Date: Sun, 28 Aug 2011 08:30:37 +0200 (MEST)

Hi Michael,

> It appears the problem comes from the fact that stdio.h is pulled in 
> indirectly from
> config.h, hence it is not surrounded by the __need_FILE macro that should 
> prevent
> the problem from occuring. The inclusion pattern is:
> 
> config.h
> stdint.h (because of octave config.h content)
> wchar.h (because of stdint.h implementation I'm using, see [1])
> stdio.h (because of wchar.h implementation in gnulib)

Thanks for this analysis. While including system header files from within
config.h can be problematic
(cf. http://www.gnu.org/software/gnulib/manual/html_node/Source-changes.html),
gnulib should not cause infinite recursions because of it.

Can you please try this patch?

--- a/lib/fopen.c
+++ b/lib/fopen.c
@@ -16,7 +16,12 @@

 /* Written by Bruno Haible <address@hidden>, 2007.  */

+/* If the user's config.h happens to include <stdio.h>, let it include only
+   the system's <stdio.h> here, so that orig_fopen doesn't recurse to
+   rpl_fopen.  */
+#define _GL_ALREADY_INCLUDING_STDIO_H
 #include <config.h>
+#undef _GL_ALREADY_INCLUDING_STDIO_H

 /* Get the original definition of fopen.  It might be defined as a macro.  */
 #define __need_FILE



reply via email to

[Prev in Thread] Current Thread [Next in Thread]