[libfortran] PR 49214 fd_gets error handling

Submitted by Janne Blomqvist on May 29, 2011, 1:19 p.m.

Details

Message ID BANLkTimMK6FH4Kd3zXXiHKuyvJ_ZGA-qsQ@mail.gmail.com
State New
Headers show

Commit Message

Janne Blomqvist May 29, 2011, 1:19 p.m.
I committed the patch below as obvious. Together with my recent patch
for PR 48931 this should fix PR 49214.

Patch hide | download patch | download mbox

Index: libgfortran/runtime/backtrace.c
===================================================================
--- libgfortran/runtime/backtrace.c     (revision 174394)
+++ libgfortran/runtime/backtrace.c     (working copy)
@@ -95,6 +95,8 @@  fd_gets (char *s, int size, int fd)
       else
        {
          s[i] = '\0';
+         if (i == 0)
+           return NULL;
          break;
        }
     }
Index: libgfortran/ChangeLog
===================================================================
--- libgfortran/ChangeLog       (revision 174394)
+++ libgfortran/ChangeLog       (working copy)
@@ -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.