RSSyl: Allow use of .netrc by libcurl. Bug/enhancement #3309, by Vincent Pelletier
[claws.git] / src / plugins / spamassassin / libspamc.c
index 0a1ab22c19064ce1eb898cc6b6cb355f45653c04..e78fd0081bc951f5b4aef0ea55ea186bb811f1dd 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include "config.h"
+#include "claws-features.h"
 #include "libspamc.h"
 #include "utils.h"
 
@@ -1089,9 +1090,9 @@ void message_cleanup(struct message *m)
 {
     if (m->out != NULL)
        free(m->out);
-    if (m->raw != NULL)
+    if (m->raw != NULL && m->raw != m->out)
        free(m->raw);
-    if (m->priv != NULL)
+    if (m->priv != NULL && (char*)m->priv != m->out && (char*)m->priv != m->raw)
        free(m->priv);
     _clear_message(m);
 }
@@ -1186,7 +1187,7 @@ int transport_setup(struct transport *tp, int flags)
     WSADATA wsaData;
     int nCode;
     if ((nCode = WSAStartup(MAKEWORD(1, 1), &wsaData)) != 0) {
-       printf("WSAStartup() returned error code %d\n", nCode);
+       g_print("WSAStartup() returned error code %d\n", nCode);
        return EX_OSERR;
     }
 
@@ -1309,8 +1310,8 @@ libspamc_log (int flags, int level, char *msg, ...)
 
         len += snprintf(buf+len, LOG_BUFSIZ-len, "\n");
         buf[LOG_BUFSIZ] = '\0';     /* ensure termination */
-        (void) write (2, buf, len);
-
+        if (write (2, buf, len) != len)
+               goto out;
     } else {
         vsnprintf(buf, LOG_BUFSIZ, msg, ap);
         buf[LOG_BUFSIZ] = '\0';     /* ensure termination */
@@ -1318,10 +1319,10 @@ libspamc_log (int flags, int level, char *msg, ...)
         syslog (level, "%s", buf);
 #else
         (void) level;  /* not used. suppress compiler warning */
-        fprintf (stderr, "%s\n", buf);
+        g_printerr ("%s\n", buf);
 #endif
     }
-
+out:
     va_end(ap);
 }
 
@@ -1355,7 +1356,7 @@ static void _test_locale_safe_string_to_float_val(float input)
        return;
     }
 
-    printf("FAIL: input=%f != output=%f\n", input, output);
+    g_print("FAIL: input=%f != output=%f\n", input, output);
 }
 
 static void unit_test_locale_safe_string_to_float(void)
@@ -1368,7 +1369,7 @@ static void unit_test_locale_safe_string_to_float(void)
     float num;
     int i;
 
-    printf("starting unit_test_locale_safe_string_to_float\n");
+    g_print("starting unit_test_locale_safe_string_to_float\n");
     /* tests of precision */
     for (i = 0; statictestset[i] != 0.0; i++) {
        _test_locale_safe_string_to_float_val(statictestset[i]);
@@ -1380,7 +1381,7 @@ static void unit_test_locale_safe_string_to_float(void)
     for (num = -1000.0; num < 1000.0; num += 0.01) {
        _test_locale_safe_string_to_float_val(num);
     }
-    printf("finished unit_test_locale_safe_string_to_float\n");
+    g_print("finished unit_test_locale_safe_string_to_float\n");
 }
 
 void do_libspamc_unit_tests(void)