]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
mlmmj-maintd: resend_requeue: cleanup stale directory
authorBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 8 Mar 2023 11:07:07 +0000 (12:07 +0100)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 8 Mar 2023 11:07:07 +0000 (12:07 +0100)
Now that we cleanly control the life cycle of our files, cleanup
the stale directory after ourself.

src/mlmmj-maintd.c
tests/mlmmj-maintd.sh

index f0c6121d822c7542b4322b74a904482eeb5d2ec9..08621bb5b93c421991b67f341612f8341cd5a233 100644 (file)
@@ -331,6 +331,7 @@ resend_requeue(struct ml *ml, const char *mlmmjsend, int logfd)
                        unlinkat(requeuefd, "mailfile", 0);
                close(subfd);
                close(requeuefd);
+               unlinkat(fd, dp->d_name, AT_REMOVEDIR);
        }
 
        closedir(queuedir);
index cc89cf68e9b78dcdf81a89392ade685a3ec143b7..96ccd4ad60185214b0140ee79df70df6483edb3c 100755 (executable)
@@ -843,7 +843,8 @@ EOF
        atf_check -s exit:0 test -f list/archive/1
        atf_check -s exit:1 test -f lists/requeue/1/subscribers
        atf_check -s exit:1 test -f list/requeue/3/mailfile
-       mkdir lists/requeue/1
+       atf_check -s exit:1 test -d list/requeue/1
+       mkdir list/requeue/1
 cat > list/archive/1 <<EOF
 From: plop
 To: bla
@@ -897,4 +898,5 @@ EOF
        atf_check $mlmmjmaintd -L list -F
        atf_check -o file:expect3.txt sed -e "/^Message-ID:/d; /^Date:/d; s/bounces-.*-/bounces-/g" mail-3.txt
        atf_check -s exit:1 test -f mail-4.txt
+       atf_check -s exit:1 test -d list/requeue/1
 }