]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libf2c/11918 (isatty does not call f_init)
authorToon Moene <toon@moene.indiv.nluug.nl>
Sun, 21 Sep 2003 16:16:46 +0000 (18:16 +0200)
committerToon Moene <toon@gcc.gnu.org>
Sun, 21 Sep 2003 16:16:46 +0000 (16:16 +0000)
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.

From-SVN: r71628

libf2c/ChangeLog
libf2c/libU77/fnum_.c
libf2c/libU77/fstat_.c
libf2c/libU77/isatty_.c

index 32647c6c7352ca15af4a185aa049f4cd77888cc0..78fc92cadd2a420b4bcf548714256c8eaf449fd4 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 Tue Sep  9 15:22:57 2003  Alan Modra  <amodra@bigpond.net.au>
 
        * configure: Regenerate.
index daf8f3dc0807333fa61a871c1ea1442d7a4ef06b..27cadec287a8ef2e37e973809cccbec73e30389f 100644 (file)
@@ -27,6 +27,10 @@ G77_fnum_0 (integer * lunit)
 {
   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
      field since udev is unix specific */
index e978c6adb2ebf3a2d02ff7df2f1b62f09ccc6212..7fd439c2a40cdc24c6e923a58e9c840abda9e6e8 100644 (file)
@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #include "config.h"
 #endif
 #include "f2c.h"
+#include "fio.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -34,6 +35,7 @@ G77_fstat_0 (const integer * lunit, integer statb[13])
   int err;
   struct stat buf;
 
+  if (f__init != 1) f_init();
   err = fstat (G77_fnum_0 (lunit), &buf);
   statb[0] = buf.st_dev;
   statb[1] = buf.st_ino;
index fa2f56dafab52fa7a11add62eb8ba20da1c30b0a..a781f757bc5477af6d3d755176dc5746210c65ab 100644 (file)
@@ -30,6 +30,7 @@ extern integer G77_fnum_0 (integer *);
 logical
 G77_isatty_0 (integer * lunit)
 {
+  if (f__init != 1) f_init();
   if (*lunit >= MXUNIT || *lunit < 0)
     err (1, 101, "isatty");
   /* f__units is a table of descriptions for the unit numbers (defined