From 22e9edd52a0e6ca23edc14e3ef24fba4da8dc13a Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Sat, 17 Dec 2005 11:45:52 +0000 Subject: e-util-private.h (fsync) Don't bother with a Win32 implementation of 2005-12-17 Tor Lillqvist * e-util-private.h (fsync) * e-util.c: Don't bother with a Win32 implementation of fsync() as the uses of fsync() in evo are pretty irrelevant. Just #define fsync() away on Win32. svn path=/trunk/; revision=30796 --- e-util/ChangeLog | 7 +++++++ e-util/e-util-private.h | 2 +- e-util/e-util.c | 31 ------------------------------- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/e-util/ChangeLog b/e-util/ChangeLog index 4065a68ca2..bd66cbe4bb 100644 --- a/e-util/ChangeLog +++ b/e-util/ChangeLog @@ -1,3 +1,10 @@ +2005-12-17 Tor Lillqvist + + * e-util-private.h (fsync) + * e-util.c: Don't bother with a Win32 implementation of fsync() as + the uses of fsync() in evo are pretty irrelevant. Just #define + fsync() away on Win32. + 2005-12-12 Irene Huang reviewed by: Veerapuram Varadhan diff --git a/e-util/e-util-private.h b/e-util/e-util-private.h index f40b09f674..35cf0cf5c2 100644 --- a/e-util/e-util-private.h +++ b/e-util/e-util-private.h @@ -33,7 +33,7 @@ #ifdef G_OS_WIN32 -int fsync (int fd); +#define fsync(fd) 0 const char *_e_get_category_icons (void) G_GNUC_CONST; const char *_e_get_datadir (void) G_GNUC_CONST; diff --git a/e-util/e-util.c b/e-util/e-util.c index 5b7875293d..b2efe75f95 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -1276,34 +1276,3 @@ e_gettext (const char *msgid) return dgettext (E_I18N_DOMAIN, msgid); } - -#ifdef G_OS_WIN32 - -int -fsync (int fd) -{ - int handle; - struct stat st; - - handle = _get_osfhandle (fd); - if (handle == -1) - return -1; - - fstat (fd, &st); - - /* FlushFileBuffers() fails if called on a handle to the - * console output. As we cannot know whether fd refers to the - * console output or not, punt, and call FlushFileBuffers() - * only for regular files and pipes. - */ - if (!(S_ISREG (st.st_mode) || S_ISFIFO (st.st_mode))) - return 0; - - if (FlushFileBuffers ((HANDLE) handle)) - return 0; - - errno = EIO; - return -1; -} - -#endif -- cgit