This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Fix for libf2c/11918, committed] Call f_init where needed, check fd in fnum_.c


2003-09-21  Toon Moene  <toon@moene.indiv.nluug.nl>

	PR libf2c/11918
	* fstat_.c: Call f_init().
	* isatty_.c: Ditto.
	* fnum_.c: Check file descriptor before handing it back.

*** fstat_.c.orig	Sat Jun  1 14:38:32 2002
--- fstat_.c	Sun Sep 21 18:02:28 2003
*************** Boston, MA 02111-1307, USA.  */
*** 24,27 ****
--- 24,28 ----
  #endif
  #include "f2c.h"
+ #include "fio.h"
  #include <sys/types.h>
  #include <sys/stat.h>
*************** G77_fstat_0 (const integer * lunit, inte
*** 35,38 ****
--- 36,40 ----
    struct stat buf;
  
+   if (f__init != 1) f_init();
    err = fstat (G77_fnum_0 (lunit), &buf);
    statb[0] = buf.st_dev;
*** isatty_.c.orig	Sat Jun  1 14:38:32 2002
--- isatty_.c	Sun Sep 21 15:52:33 2003
*************** logical
*** 31,34 ****
--- 31,35 ----
  G77_isatty_0 (integer * lunit)
  {
+   if (f__init != 1) f_init();
    if (*lunit >= MXUNIT || *lunit < 0)
      err (1, 101, "isatty");
*** fnum_.c.orig	Sat Jun  1 14:38:32 2002
--- fnum_.c	Sun Sep 21 16:30:49 2003
*************** G77_fnum_0 (integer * lunit)
*** 28,31 ****
--- 28,35 ----
    if (*lunit >= MXUNIT || *lunit < 0)
      err (1, 101, "fnum");
+ 
+   if (f__units[*lunit].ufd == NULL)
+     err (1, 114, "fnum");
+ 
    /* f__units is a table of descriptions for the unit numbers (defined
       in io.h).  Use file descriptor (ufd) and fileno rather than udev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]