PR 49214 fd_gets should return NULL if nothing was read
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 May 2011 13:17:17 +0000 (13:17 +0000)
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 May 2011 13:17:17 +0000 (13:17 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174395 138bc75d-0d04-0410-961f-82ee72b054a4

libgfortran/ChangeLog
libgfortran/runtime/backtrace.c

index 1d08da8..f0e3078 100644 (file)
@@ -1,5 +1,10 @@
 2011-05-29  Janne Blomqvist  <jb@gcc.gnu.org>
 
+       PR libfortran/49214
+       * runtime/backtrace.c (fd_gets): Return NULL if nothing was read.
+
+2011-05-29  Janne Blomqvist  <jb@gcc.gnu.org>
+
        PR libfortran/19155
        * io/read.c (convert_real): Check for invalid input by comparing
        endptr instead of EINVAL.
index dff4466..943332a 100644 (file)
@@ -95,6 +95,8 @@ fd_gets (char *s, int size, int fd)
       else
        {
          s[i] = '\0';
+         if (i == 0)
+           return NULL;
          break;
        }
     }