unix.c (buf_write): Return early if there is nothing to write.
authorThomas Koenig <tkoenig@gcc.gnu.org>
Mon, 24 Jul 2017 10:42:23 +0000 (10:42 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Mon, 24 Jul 2017 10:42:23 +0000 (10:42 +0000)
2017-07-24  Thomas Koenig  <tkoenig@gcc.gnu.org>

* io/unix.c (buf_write):  Return early if there is
nothing to write.

From-SVN: r250473

libgfortran/ChangeLog
libgfortran/io/unix.c

index f34b4df785a3b09c672c238554022a4b1099138d..d29f4f46100d31e75e1cb9ad63834745aee95c37 100644 (file)
@@ -1,3 +1,8 @@
+2017-07-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
+
+       * io/unix.c (buf_write):  Return early if there is
+       nothing to write.
+
 2017-06-09  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        * intrinsics/eoshift2.c (eoshift2):  Use memcpy
index c76b427387addfe588d952d7152f4cc7e3a2e2af..61e9f7997b25819514af546b50aa1d00b1d116f9 100644 (file)
@@ -582,6 +582,9 @@ buf_read (unix_stream *s, void *buf, ssize_t nbyte)
 static ssize_t
 buf_write (unix_stream *s, const void *buf, ssize_t nbyte)
 {
+  if (nbyte == 0)
+    return 0;
+
   if (s->ndirty == 0)
     s->buffer_offset = s->logical_offset;