summaryrefslogtreecommitdiff
path: root/mysys/my_write.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/my_write.c')
-rw-r--r--mysys/my_write.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/mysys/my_write.c b/mysys/my_write.c
index f261c768dcb..b545ab776b0 100644
--- a/mysys/my_write.c
+++ b/mysys/my_write.c
@@ -38,7 +38,17 @@ size_t my_write(int Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
for (;;)
{
- if ((writenbytes= write(Filedes, Buffer, Count)) == Count)
+ writenbytes= write(Filedes, Buffer, Count);
+ /**
+ To simulate the write error set the errno = error code
+ and the number pf written bytes to -1.
+ */
+ DBUG_EXECUTE_IF ("simulate_file_write_error",
+ {
+ errno= ENOSPC;
+ writenbytes= (size_t) -1;
+ });
+ if (writenbytes == Count)
break;
if (writenbytes != (size_t) -1)
{ /* Safeguard */