summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_write.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mysys/my_write.c b/mysys/my_write.c
index 4c3d187e4e8..08d70accd57 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -29,6 +29,10 @@ uint my_write(int Filedes, const byte *Buffer, uint Count, myf MyFlags)
Filedes, (long) Buffer, Count, MyFlags));
errors=0; written=0L;
+ /* The behavior of write(fd, buf, 0) is not portable */
+ if (unlikely(!Count))
+ return 0;
+
for (;;)
{
if ((writenbytes = (uint) write(Filedes, Buffer, Count)) == Count)