Fixes build for windows.
+2013-11-27 Vladimir Serbinenko <phcoder@gmail.com>
+
+ Introduce grub_util_file_sync and use it instead of fsync(fileno(f)).
+ Fixes build for windows.
+
2013-11-27 Vladimir Serbinenko <phcoder@gmail.com>
* gentpl.py: Don't generate platform-dependent conditionals for
}
}
+void
+grub_util_file_sync (FILE *f)
+{
+ fflush (f);
+ if (!allow_fd_syncs)
+ return;
+ fsync (fileno (f));
+}
+
void
grub_util_disable_fd_syncs (void)
{
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)
{
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
grub_util_fopen (const char *path, const char *mode);
#endif
+void grub_util_file_sync (FILE *f);
+
#endif /* GRUB_EMU_MISC_H */
char *
grub_util_tchar_to_utf8 (LPCTSTR in);
-#ifdef __MINGW32__
-
-int fsync (int fno);
-
-#endif
-
#endif
grub_util_error (_("cannot write to `%s': %s"), namenew,
strerror (errno));
- fsync (fileno (fp));
+
+ grub_util_file_sync (fp);
free (buf);
fclose (fp);
grub_util_error (_("cannot write to `%s': %s"), name,
strerror (errno));
- fsync (fileno (fp));
+ grub_util_file_sync (fp);
fclose (fp);
}
grub_install_make_image_wrap_file (dir, prefix, fp, outname,
memdisk_path, config_path,
mkimage_target, note, comp);
- fflush (fp);
- grub_util_fd_sync (fileno (fp));
+ grub_util_file_sync (fp);
fclose (fp);
}
arguments.image_target, arguments.note,
arguments.comp);
- fflush (fp);
- fsync (fileno (fp));
+ grub_util_file_sync (fp);
fclose (fp);
if (arguments.dir)