aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.c
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2017-07-24 10:42:23 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2017-07-24 10:42:23 +0000
commitff9a87509d68a92b8ec062c9eb5d80977de2196f (patch)
tree560cee2cae013106b7f130a833abd9f2bee42127 /libgfortran/io/unix.c
parentcedc228d1c0feef83c36ccbeb7faa26c53af1b18 (diff)
downloadgcc-ff9a87509d68a92b8ec062c9eb5d80977de2196f.zip
gcc-ff9a87509d68a92b8ec062c9eb5d80977de2196f.tar.gz
gcc-ff9a87509d68a92b8ec062c9eb5d80977de2196f.tar.bz2
unix.c (buf_write): Return early if there is nothing to write.
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
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r--libgfortran/io/unix.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index c76b427..61e9f79 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -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;