PR 49214 fd_gets should return NULL if nothing was read
authorJanne Blomqvist <jb@gcc.gnu.org>
Sun, 29 May 2011 13:17:17 +0000 (16:17 +0300)
committerJanne Blomqvist <jb@gcc.gnu.org>
Sun, 29 May 2011 13:17:17 +0000 (16:17 +0300)
From-SVN: r174395

libgfortran/ChangeLog
libgfortran/runtime/backtrace.c

index 1d08da8c3b9d88ff1cfe460423ef53d70a028f1c..f0e3078e8b3623600c405538a89acc0d73c62dad 100644 (file)
@@ -1,3 +1,8 @@
+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
index dff4466aa56d46bc00f2df32952bcd892d380f94..943332ab615b82425945c765101e315158c6c731 100644 (file)
@@ -95,6 +95,8 @@ fd_gets (char *s, int size, int fd)
       else
        {
          s[i] = '\0';
+         if (i == 0)
+           return NULL;
          break;
        }
     }