[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-107-g45c1dc4e6
wwp at claws-mail.org
wwp at claws-mail.org
Fri Sep 3 07:34:09 UTC 2021
The branch, gtk3 has been updated
via 45c1dc4e6e39f9d5ac83816302d043b5dee565e6 (commit)
from e121fc4767e57fd6018997b75d636264049c9ce8 (commit)
Summary of changes:
src/plugins/bogofilter/bogofilter.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 45c1dc4e6e39f9d5ac83816302d043b5dee565e6
Author: wwp <subscript at free.fr>
Date: Fri Sep 3 09:32:46 2021 +0200
CID1440023: use the number of bytes read() from bogofilter's stdout.
diff --git a/src/plugins/bogofilter/bogofilter.c b/src/plugins/bogofilter/bogofilter.c
index 1b2d9db9e..a65b402b5 100644
--- a/src/plugins/bogofilter/bogofilter.c
+++ b/src/plugins/bogofilter/bogofilter.c
@@ -208,6 +208,7 @@ static void bogofilter_do_filter(BogoFilterData *data)
for (cur = data->msglist; cur; cur = cur->next) {
gboolean whitelisted = FALSE;
msginfo = (MsgInfo *)cur->data;
+ ssize_t n_read;
debug_print("Filtering message %d (%d/%d)\n", msginfo->msgnum, curnum, total);
if (message_callback != NULL)
@@ -229,7 +230,7 @@ static void bogofilter_do_filter(BogoFilterData *data)
g_free(tmp);
memset(buf, 0, sizeof(buf));
/* get the result */
- if (read(bogo_stdout, buf, sizeof(buf)-1) < 0) {
+ if (n_read = read(bogo_stdout, buf, sizeof(buf)-1) < 0) {
g_warning("bogofilter short read");
debug_print("message %d is ham\n", msginfo->msgnum);
data->mail_filtering_data->unfiltered = g_slist_prepend(
@@ -238,14 +239,14 @@ static void bogofilter_do_filter(BogoFilterData *data)
} else {
gchar **parts = NULL;
- buf[sizeof(buf) - 1] = '\0';
+ buf[n_read] = '\0';
if (strchr(buf, '/')) {
tmp = strrchr(buf, '/')+1;
} else {
tmp = buf;
}
parts = g_strsplit(tmp, " ", 0);
- debug_print("read %s\n", buf);
+ debug_print("read '%s' (%ld bytes)\n", buf, n_read);
/* note the result if the header if needed */
if (parts && parts[0] && parts[1] && parts[2] &&
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list