Commit e9491526 by Toon Moene Committed by Toon Moene

re PR libf2c/11918 (isatty does not call f_init)

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
parent fa543fdd
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> Tue Sep 9 15:22:57 2003 Alan Modra <amodra@bigpond.net.au>
* configure: Regenerate. * configure: Regenerate.
......
...@@ -27,6 +27,10 @@ G77_fnum_0 (integer * lunit) ...@@ -27,6 +27,10 @@ G77_fnum_0 (integer * lunit)
{ {
if (*lunit >= MXUNIT || *lunit < 0) if (*lunit >= MXUNIT || *lunit < 0)
err (1, 101, "fnum"); 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 /* f__units is a table of descriptions for the unit numbers (defined
in io.h). Use file descriptor (ufd) and fileno rather than udev in io.h). Use file descriptor (ufd) and fileno rather than udev
field since udev is unix specific */ field since udev is unix specific */
......
...@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h" #include "config.h"
#endif #endif
#include "f2c.h" #include "f2c.h"
#include "fio.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -34,6 +35,7 @@ G77_fstat_0 (const integer * lunit, integer statb[13]) ...@@ -34,6 +35,7 @@ G77_fstat_0 (const integer * lunit, integer statb[13])
int err; int err;
struct stat buf; struct stat buf;
if (f__init != 1) f_init();
err = fstat (G77_fnum_0 (lunit), &buf); err = fstat (G77_fnum_0 (lunit), &buf);
statb[0] = buf.st_dev; statb[0] = buf.st_dev;
statb[1] = buf.st_ino; statb[1] = buf.st_ino;
......
...@@ -30,6 +30,7 @@ extern integer G77_fnum_0 (integer *); ...@@ -30,6 +30,7 @@ extern integer G77_fnum_0 (integer *);
logical logical
G77_isatty_0 (integer * lunit) G77_isatty_0 (integer * lunit)
{ {
if (f__init != 1) f_init();
if (*lunit >= MXUNIT || *lunit < 0) if (*lunit >= MXUNIT || *lunit < 0)
err (1, 101, "isatty"); err (1, 101, "isatty");
/* f__units is a table of descriptions for the unit numbers (defined /* f__units is a table of descriptions for the unit numbers (defined
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment