This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: fix fixincludes fake warnings
- To: GCC-Patches <gcc-patches at gcc dot gnu dot org>
- Subject: Re: PATCH: fix fixincludes fake warnings
- From: Bruce Korb <bkorb at cruzio dot com>
- Date: Mon, 29 Jan 2001 10:42:57 -0800
- CC: bkorb at allegronetworks dot com
- Reply-To: bkorb at allegronetworks dot com
If someone would be kind enough to apply this patch,
it would address both the spurious message and the
inappropriate closing of stdin. (I have started at a new
company and paperwork has to be done & I need to set up
CVS access....) Thanks!
Index: fixincl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/fixincl.c,v
retrieving revision 1.49
diff -u -r1.49 fixincl.c
--- fixincl.c 2001/01/05 16:28:58 1.49
+++ fixincl.c 2001/01/29 18:32:46
@@ -364,14 +364,13 @@
res = (char*)mmap ((void*)NULL, data_map_size, PROT_READ,
MAP_PRIVATE, data_map_fd, 0);
if (res == (char*)BAD_ADDR)
+#endif
{
+ FILE* fp = fdopen (data_map_fd, "r");
curr_data_mapped = BOOL_FALSE;
- res = load_file_data ( fdopen (data_map_fd, "r"));
+ res = load_file_data (fp);
+ fclose (fp);
}
-#else
- curr_data_mapped = BOOL_FALSE;
- res = load_file_data ( fdopen (data_map_fd, "r"));
-#endif
return res;
}
@@ -1431,8 +1430,9 @@
read_fd = open (pz_temp_file, O_RDONLY);
if (read_fd < 0)
{
- fprintf (stderr, "error %d (%s) opening output (%s) for read\n",
- errno, xstrerror (errno), pz_temp_file);
+ if (errno != ENOENT)
+ fprintf (stderr, "error %d (%s) opening output (%s) for
read\n",
+ errno, xstrerror (errno), pz_temp_file);
}
else
{
Index: fixlib.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/fixlib.c,v
retrieving revision 1.15
diff -u -r1.15 fixlib.c
--- fixlib.c 2000/12/02 19:46:32 1.15
+++ fixlib.c 2001/01/29 18:40:08
@@ -39,6 +39,9 @@
int space_left = -1; /* allow for terminating NUL */
size_t space_used = 0;
+ if (fp == (FILE*)NULL)
+ return pz_data;
+
do
{
size_t size_read;
@@ -62,7 +65,6 @@
fprintf (stderr, "error %d (%s) reading input\n", err,
xstrerror (err));
free ((void *) pz_data);
- fclose (fp);
return (char *) NULL;
}
}
@@ -73,7 +75,6 @@
pz_data = xrealloc ((void*)pz_data, space_used+1 );
pz_data[ space_used ] = NUL;
- fclose (fp);
return pz_data;
}