From: Baptiste Daroussin Date: Sat, 9 Dec 2023 19:18:49 +0000 (+0100) Subject: fix: incremental update X-Git-Tag: RELEASE_1_4_1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=518f45cfaf347ad32d3b2f49416181fa3f9261af;p=thirdparty%2Fmlmmj.git fix: incremental update --- diff --git a/src/incindexfile.c b/src/incindexfile.c index ce85fa2a..33fc50e8 100644 --- a/src/incindexfile.c +++ b/src/incindexfile.c @@ -51,7 +51,7 @@ int incindexfile(int listfd) return 0; } - fp = fdopen(fd, "r"); + fp = fdopen(fd, "r+"); if (fp == NULL) { log_error(LOG_ARGS, "Error fdopening index file"); close(fd); diff --git a/tests/mlmmj-receive.sh b/tests/mlmmj-receive.sh index a67c18c7..5c29d285 100755 --- a/tests/mlmmj-receive.sh +++ b/tests/mlmmj-receive.sh @@ -22,7 +22,7 @@ tests_init \ moderation_reject_invalid \ maxmailsize \ maxmailsize0 \ - normail_email \ + normal_email \ delheaders \ customheaders \ verp @@ -2483,7 +2483,7 @@ EOF return } -normail_email_body() +normal_email_body() { atf_check $srcdir/fakesmtpd trap kill_fakesmtp EXIT TERM @@ -2539,13 +2539,38 @@ EOF atf_check -o file:expected-1.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-1.txt touch list/control/footer atf_check -s exit:0 $mlmmjreceive -L list -F > expected-2.txt < +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: yeah + +Let's go, first email + +. +MAIL FROM: +RCPT TO: +DATA +From: bob@test +To: test@mlmmjtest +Subject: yeah + +Let's go, first email + +. +QUIT +EOF + atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-2.txt printf "myfooter\nreally" > list/control/footer touch list/control/prefix atf_check -s exit:0 $mlmmjreceive -L list -F > expected-2.txt <> expected-3.txt < +MAIL FROM: RCPT TO: DATA From: bob@test @@ -2556,7 +2581,7 @@ Let's go, first email myfooter really . -MAIL FROM: +MAIL FROM: RCPT TO: DATA From: bob@test @@ -2569,12 +2594,12 @@ really . QUIT EOF - atf_check -o file:expected-2.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-3.txt + atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-3.txt echo "[plop]" > list/control/prefix atf_check -s exit:0 $mlmmjreceive -L list -F > expected-3.txt <> expected-4.txt < +MAIL FROM: RCPT TO: DATA From: bob@test @@ -2585,7 +2610,7 @@ Let's go, first email myfooter really . -MAIL FROM: +MAIL FROM: RCPT TO: DATA From: bob@test @@ -2598,12 +2623,12 @@ really . QUIT EOF - atf_check -o file:expected-3.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-4.txt + atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-4.txt atf_check -s exit:0 $mlmmjreceive -L list -F > expected-4.txt <> expected-5.txt < +MAIL FROM: RCPT TO: DATA From: bob@test @@ -2614,7 +2639,7 @@ Let's go, first email myfooter really . -MAIL FROM: +MAIL FROM: RCPT TO: DATA From: bob@test @@ -2627,7 +2652,7 @@ really . QUIT EOF - atf_check -o file:expected-4.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-5.txt + atf_check -o file:expected-5.txt sed -e "/^Message-ID:/d; /^Date:/d;" mail-5.txt } delheaders_body() @@ -2746,7 +2771,7 @@ EOF atf_check -s exit:0 $mlmmjreceive -L list -F > expected-2.txt < +MAIL FROM: RCPT TO: DATA From: bob@test @@ -2759,7 +2784,7 @@ Subject: yeah Let's go, first email . -MAIL FROM: +MAIL FROM: RCPT TO: DATA From: bob@test diff --git a/tests/mlmmj.c b/tests/mlmmj.c index 764f26f7..27b188be 100644 --- a/tests/mlmmj.c +++ b/tests/mlmmj.c @@ -1404,6 +1404,7 @@ ATF_TC_BODY(incindexfile, tc) unlink("list/index"); atf_utils_create_file("list/index", "1"); ATF_REQUIRE_EQ(incindexfile(fd), 2); + ATF_REQUIRE_EQ(incindexfile(fd), 3); close(fd); }