Patch for malloc/mtrace.c

Mark Kettenis kettenis@wins.uva.nl
Sun Feb 18 03:02:00 GMT 2001


I'm having a bit of a problem with the use of fopen64 in
malloc/mtrace.c:

1. The Hurd doesn't have fopen64.

2. The use of fopen64 pollutes the ISO C namespace.

While I can solve (1) by implementing fopen64 in GNU stdio, and it can
be argued that (2) isn't an issue, since mtrace() itself isn't ISO C,
I'd personally still prefer using the attached patch to solve the
problem.

Mark


2001-02-18  Mark Kettenis  <kettenis@gnu.org>

	* malloc/mtrace.c [USE_IN_LIBIO]: Define fopen as _IO_fopen64.
	(mtrace): Revert 2001-02-13 patch: use fopen instead of fopen64.


Index: malloc/mtrace.c
===================================================================
RCS file: /cvs/glibc/libc/malloc/mtrace.c,v
retrieving revision 1.25
diff -u -p -r1.25 mtrace.c
--- malloc/mtrace.c 2001/02/13 22:06:16 1.25
+++ malloc/mtrace.c 2001/02/18 10:50:08
@@ -42,6 +42,7 @@
 
 #ifdef USE_IN_LIBIO
 # include <libio/iolibio.h>
+# define fopen(f, n) _IO_fopen64 (f, n)
 # define setvbuf(s, b, f, l) _IO_setvbuf (s, b, f, l)
 #endif
 
@@ -268,7 +269,7 @@ mtrace ()
 #endif
   if (mallfile != NULL || mallwatch != NULL)
     {
-      mallstream = fopen64 (mallfile != NULL ? mallfile : "/dev/null", "w");
+      mallstream = fopen (mallfile != NULL ? mallfile : "/dev/null", "w");
       if (mallstream != NULL)
 	{
 	  /* Make sure we close the file descriptor on exec.  */



More information about the Libc-hacker mailing list