[Commits] [SCM] claws branch, master, updated. 3.17.0-101-ge745553
Colin
colin at claws-mail.org
Sun Oct 7 20:41:36 CEST 2018
The branch, master has been updated
via e745553712a30022d6d34602b4279604df0ce945 (commit)
from d71e99303d0b82fde93cd90300487d1b3a567e95 (commit)
Summary of changes:
src/common/file-utils.c | 28 ++++++++++++++--------------
src/common/file-utils.h | 4 +---
2 files changed, 15 insertions(+), 17 deletions(-)
- Log -----------------------------------------------------------------
commit e745553712a30022d6d34602b4279604df0ce945
Author: Colin Leroy <colin at colino.net>
Date: Sun Oct 7 20:41:20 2018 +0200
Make safe_fclose static now that it can be
diff --git a/src/common/file-utils.c b/src/common/file-utils.c
index 8f58fec..0d6d227 100644
--- a/src/common/file-utils.c
+++ b/src/common/file-utils.c
@@ -34,8 +34,7 @@
gboolean prefs_common_get_flush_metadata(void);
gboolean prefs_common_get_use_shred(void);
-/* FIXME make static once every file I/O is done using claws_* wrappers */
-int safe_fclose(FILE *fp)
+static int safe_fclose(FILE *fp)
{
int r;
START_TIMING("");
@@ -53,6 +52,18 @@ int safe_fclose(FILE *fp)
return r;
}
+/* Unlock, then safe-close a file pointer
+ * Safe close is done using fflush + fsync
+ * if the according preference says so.
+ */
+int claws_safe_fclose(FILE *fp)
+{
+#if HAVE_FGETS_UNLOCKED
+ funlockfile(fp);
+#endif
+ return safe_fclose(fp);
+}
+
#if HAVE_FGETS_UNLOCKED
/* Open a file and locks it once
@@ -84,16 +95,7 @@ int claws_fclose(FILE *fp)
funlockfile(fp);
return fclose(fp);
}
-
-/* Unlock, then safe-close a file pointer
- * Safe close is done using fflush + fsync
- * if the according preference says so.
- */
-int claws_safe_fclose(FILE *fp)
-{
- funlockfile(fp);
- return safe_fclose(fp);
-}
+#endif
#ifdef G_OS_WIN32
#define WEXITSTATUS(x) (x)
@@ -875,5 +877,3 @@ FILE *str_open_as_stream(const gchar *str)
rewind(fp);
return fp;
}
-
-#endif
diff --git a/src/common/file-utils.h b/src/common/file-utils.h
index 10926f0..398bfde 100644
--- a/src/common/file-utils.h
+++ b/src/common/file-utils.h
@@ -42,7 +42,6 @@ FILE *claws_fopen (const char *file,
FILE *claws_fdopen (int fd,
const char *mode);
int claws_fclose (FILE *fp);
-int claws_safe_fclose (FILE *fp);
#else
@@ -57,10 +56,9 @@ int claws_safe_fclose (FILE *fp);
#define claws_fopen g_fopen
#define claws_fdopen fdopen
#define claws_fclose fclose
-#define claws_safe_fclose safe_fclose
#endif
-int safe_fclose (FILE *fp);
+int claws_safe_fclose (FILE *fp);
int claws_unlink (const char *filename);
gint file_strip_crs (const gchar *file);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list