| 133 | #ifdef NEED_EXPLICIT_SYNC_DIR |
| 134 | |
| 135 | int my_sync_dir(const char *dir_name, myf my_flags) |
| 136 | { |
| 137 | File dir_fd; |
| 138 | int res= 0; |
| 139 | const char *correct_dir_name; |
| 140 | DBUG_ENTER("my_sync_dir"); |
| 141 | DBUG_PRINT("my",("Dir: '%s' my_flags: %d", dir_name, my_flags)); |
| 142 | /* Sometimes the path does not contain an explicit directory */ |
| 143 | correct_dir_name= (dir_name[0] == 0) ? cur_dir_name : dir_name; |
| 144 | /* |
| 145 | Syncing a dir may give EINVAL on tmpfs on Linux, which is ok. |
| 146 | EIO on the other hand is very important. Hence MY_IGNORE_BADFD. |
| 147 | */ |
| 148 | if ((dir_fd= my_open(correct_dir_name, O_RDONLY, MYF(my_flags))) >= 0) |
| 149 | { |
| 150 | if (my_sync(dir_fd, MYF(my_flags | MY_IGNORE_BADFD))) |
| 151 | res= 2; |
| 152 | if (my_close(dir_fd, MYF(my_flags))) |
| 153 | res= 3; |
| 154 | } |
| 155 | else |
| 156 | res= 1; |
| 157 | DBUG_RETURN(res); |
| 158 | } |
| 159 | |
| 160 | #else /* NEED_EXPLICIT_SYNC_DIR */ |
| 161 |
no test coverage detected