mirror of
https://github.com/AltraMayor/f3.git
synced 2025-09-17 11:06:16 -04:00
f3read: fix for Windows/Cygwin
Windows requires that the file descriptor passed to fdatasync(2) to be writable. Tom Hall reported the issue and proposed the solution.
This commit is contained in:
parent
7bd73cc434
commit
44ec7ce70e
7
f3read.c
7
f3read.c
@ -54,7 +54,14 @@ static void validate_file(const char *path, int number,
|
||||
full_fn_from_number(full_fn, &filename, path, number);
|
||||
printf("Validating file %s ... %s", filename, progress ? BLANK : "");
|
||||
fflush(stdout);
|
||||
#ifdef CYGWIN
|
||||
/* We don't need write access, but some kernels require that
|
||||
* the file descriptor passed to fdatasync(2) to be writable.
|
||||
*/
|
||||
f = fopen(full_fn, "rb+");
|
||||
#else
|
||||
f = fopen(full_fn, "rb");
|
||||
#endif
|
||||
if (!f)
|
||||
err(errno, "Can't open file %s", full_fn);
|
||||
fd = fileno(f);
|
||||
|
Loading…
x
Reference in New Issue
Block a user