mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
Introduce grub_util_file_sync and use it instead of fsync(fileno(f)).
Fixes build for windows.
This commit is contained in:
1 parent
b1f742c103
commit
4f9541226c
10 files changed
+37
-15
No files matched your search
@@ -485,6 +485,15 @@ grub_util_fd_sync (grub_util_fd_t fd)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grub_util_file_sync (FILE *f)
|
||||
{
|
||||
fflush (f);
|
||||
if (!allow_fd_syncs)
|
||||
return;
|
||||
fsync (fileno (f));
|
||||
}
|
||||
|
||||
void
|
||||
grub_util_disable_fd_syncs (void)
|
||||
{
|
||||
|
||||
@@ -200,6 +200,15 @@ grub_util_fd_sync (grub_util_fd_t fd)
|
||||
fsync (fd);
|
||||
}
|
||||
|
||||
void
|
||||
grub_util_file_sync (FILE *f)
|
||||
{
|
||||
fflush (f);
|
||||
if (!allow_fd_syncs)
|
||||
return;
|
||||
fsync (fileno (f));
|
||||
}
|
||||
|
||||
void
|
||||
grub_util_disable_fd_syncs (void)
|
||||
{
|
||||
|
||||
@@ -584,12 +584,16 @@ grub_util_fopen (const char *path, const char *mode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int fsync (int fno)
|
||||
void
|
||||
grub_util_file_sync (FILE *f)
|
||||
{
|
||||
HANDLE hnd;
|
||||
hnd = (HANDLE) _get_osfhandle (fno);
|
||||
|
||||
fflush (f);
|
||||
if (!allow_fd_syncs)
|
||||
return;
|
||||
hnd = (HANDLE) _get_osfhandle (fileno (f));
|
||||
FlushFileBuffers (hnd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
Reference in new issue
Block a user