octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #53034] Octave GUI fails to open when stdin cl


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #53034] Octave GUI fails to open when stdin closed. Patch included
Date: Thu, 1 Feb 2018 13:41:18 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:58.0) Gecko/20100101 Firefox/58.0

Follow-up Comment #5, bug #53034 (project octave):

No, I actually just wrote a little C test program and I don't think this
change actually helps at all:


$ cat checkstdin.c
#include <stdio.h>

int
main (int argc, char *argv[])
{
  printf ("fileno (stdin) == %d\n", fileno (stdin));
  return 0;
}
$ ./checkstdin 
fileno (stdin) == 0
$ ./checkstdin 0<&-
fileno (stdin) == 0


So I don't see any difference, fileno(stdin) returns 0 whether stdin is open
or closed.

The forum discussion also suggested using fstat (or octave_fstat_wrapper in
our case) to test whether the file descriptor is valid. That does do something
useful for me:


$ cat checkstdin.c
#include <stdio.h>
#include <sys/stat.h>

int
main (int argc, char *argv[])
{
  struct stat buf;
  printf ("fileno (stdin) == %d\n", fileno (stdin));
  printf ("fstat (fileno (stdin)) == %d\n", fstat (fileno (stdin), &buf));
  return 0;
}
$ ./checkstdin
fileno (stdin) == 0
fstat (fileno (stdin)) == 0
$ ./checkstdin </dev/null
fileno (stdin) == 0
fstat (fileno (stdin)) == 0
$ ./checkstdin <&-
fileno (stdin) == 0
fstat (fileno (stdin)) == -1


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?53034>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]