diff options
Diffstat (limited to 'mysys/my_write.c')
-rw-r--r-- | mysys/my_write.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mysys/my_write.c b/mysys/my_write.c index 96f25a5bc57..a93f6030c1e 100644 --- a/mysys/my_write.c +++ b/mysys/my_write.c @@ -50,6 +50,17 @@ size_t my_write(int Filedes, const uchar *Buffer, size_t Count, myf MyFlags) #else writtenbytes= write(Filedes, Buffer, Count); #endif + + /** + 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; + writtenbytes= (size_t) -1; + }); + if (writtenbytes == Count) break; if (writtenbytes != (size_t) -1) |