|
1 |
| -/* Copyright (c) 2000-2002, 2004, 2006, 2007 MySQL AB |
| 1 | +/* Copyright (c) 2000-2002, 2004, 2006, 2007, 2013 MySQL AB |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify
|
4 | 4 | it under the terms of the GNU General Public License as published by
|
@@ -44,8 +44,18 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
|
44 | 44 | for (;;)
|
45 | 45 | {
|
46 | 46 | errno= 0; /* Linux doesn't reset this */
|
47 |
| - if ((readbytes= read(Filedes, Buffer, (uint) Count)) != Count) |
| 47 | + if (DBUG_EVALUATE_IF("simulate_file_read_error", 1, 0) || |
| 48 | + (readbytes= read(Filedes, Buffer, (uint) Count)) != Count) |
48 | 49 | {
|
| 50 | + DBUG_EXECUTE_IF ("simulate_file_read_error", |
| 51 | + { |
| 52 | + errno= ENOSPC; |
| 53 | + readbytes= (size_t) -1; |
| 54 | + DBUG_SET("-d,simulate_file_read_error"); |
| 55 | + DBUG_SET("-d,simulate_my_b_fill_error"); |
| 56 | + }); |
| 57 | + |
| 58 | + |
49 | 59 | my_errno= errno ? errno : -1;
|
50 | 60 | DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d",
|
51 | 61 | (int) readbytes, (ulong) Count, Filedes,
|
|
0 commit comments