Fix hang on IMAP - the log file is accessed by multiple threads
authorColin Leroy <colin@colino.net>
Sun, 7 Oct 2018 19:31:37 +0000 (21:31 +0200)
committerColin Leroy <colin@colino.net>
Sun, 7 Oct 2018 19:31:37 +0000 (21:31 +0200)
src/common/log.c

index 83b023e2becd40aa951b08578b1299d9e2a6bc2e..344eb97f2db674cc0d2445262133f83916a7c4c1 100644 (file)
 #include "hooks.h"
 #include "file-utils.h"
 
-#define FWRITE(_b,_s,_n,_f)    if (claws_fwrite(_b,_s,_n,_f) != _n) { \
-                                       g_message("log claws_fwrite failed!\n"); \
+#define FWRITE(_b,_s,_n,_f)    if (fwrite(_b,_s,_n,_f) != _n) { \
+                                       g_message("log fwrite failed!\n"); \
                                        return; \
                                }
-#define FPUTS(_b,_f)           if (claws_fputs(_b,_f) == EOF) { \
-                                       g_message("log claws_fputs failed!\n"); \
+#define FPUTS(_b,_f)           if (fputs(_b,_f) == EOF) { \
+                                       g_message("log fputs failed!\n"); \
                                        return; \
                                }
 #define FFLUSH(_f)             if (fflush(_f) != 0) { \
@@ -121,9 +121,9 @@ void set_log_file(LogInstance instance, const gchar *filename)
                g_free(backupname);
        }
 
-       log_fp[instance] = claws_fopen(fullname, "wb");
+       log_fp[instance] = fopen(fullname, "wb");
        if (!log_fp[instance]) {
-               FILE_OP_ERROR(fullname, "claws_fopen");
+               FILE_OP_ERROR(fullname, "fopen");
                log_filename[instance] = NULL;
                g_free(fullname);
                return;
@@ -136,7 +136,7 @@ void set_log_file(LogInstance instance, const gchar *filename)
 void close_log_file(LogInstance instance)
 {
        if (log_fp[instance]) {
-               claws_safe_fclose(log_fp[instance]);
+               fclose(log_fp[instance]);
                log_fp[instance] = NULL;
                log_size[instance] = 0;
                g_free(log_filename[instance]);