diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-03-17 09:45:30 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-03-17 09:45:30 +0000 |
commit | de2c3c4a63814b0852b17a822274453afda67188 (patch) | |
tree | 831cd0db73f7379bdddff99934dde541cf9a22dc /libsylph/prefs.c | |
parent | d0240722220985b4ca879c6caa1ca927d5309588 (diff) |
win32: use _commit().
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2123 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/prefs.c')
-rw-r--r-- | libsylph/prefs.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/libsylph/prefs.c b/libsylph/prefs.c index 56a2eda6..12dd057c 100644 --- a/libsylph/prefs.c +++ b/libsylph/prefs.c @@ -1,6 +1,6 @@ /* * LibSylph -- E-Mail client library - * Copyright (C) 1999-2008 Hiroyuki Yamamoto + * Copyright (C) 1999-2009 Hiroyuki Yamamoto * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,11 @@ #include <unistd.h> #include <errno.h> +#ifdef G_OS_WIN32 +# include <windows.h> +# include <io.h> +#endif + #include "prefs.h" #include "codeconv.h" #include "utils.h" @@ -373,9 +378,6 @@ gint prefs_file_close(PrefFile *pfile) { PrefFilePrivate *priv = (PrefFilePrivate *)pfile; FILE *fp; -#if HAVE_FSYNC - gint fd; -#endif gchar *path; gchar *tmppath; gchar *bakpath = NULL; @@ -397,13 +399,18 @@ gint prefs_file_close(PrefFile *pfile) goto finish; } #if HAVE_FSYNC - if ((fd = fileno(fp)) >= 0) { - if (fsync(fd) < 0) { - FILE_OP_ERROR(tmppath, "fsync"); - fclose(fp); - ret = -1; - goto finish; - } + if (fsync(fileno(fp)) < 0) { + FILE_OP_ERROR(tmppath, "fsync"); + fclose(fp); + ret = -1; + goto finish; + } +#elif defined(G_OS_WIN32) + if (_commit(_fileno(fp)) < 0) { + FILE_OP_ERROR(tmppath, "_commit"); + fclose(fp); + ret = -1; + goto finish; } #endif if (fclose(fp) == EOF) { |