freebsd-ports/mail/mailutils/files/git-113e144
Alexey Dokuchaev 48808bbb3d Cherry-pick the following two changes from the upstream Git repository
at http://git.savannah.gnu.org/cgit/mailutils.git:

  018df5d628f4e093f7e45c00b48ffc11b234d8cf - Minor fix
  113e144dedbebb5bc659eadc7f329450bb374606 - Fix mandatory locking

Requested by:	maintainer
2019-07-31 11:44:17 +00:00

38 lines
980 B
Text

From 113e144dedbebb5bc659eadc7f329450bb374606 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
Date: Tue, 23 Jul 2019 11:08:04 +0300
Subject: Fix mandatory locking
* lib/manlock.c (mailbox_open_and_lock): Force proper locker if
a null locker is associated with the mailbox.
---
lib/manlock.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/manlock.c b/lib/manlock.c
index 4a3b2be..392c581 100644
--- a/lib/manlock.c
+++ b/lib/manlock.c
@@ -126,6 +126,19 @@ mailbox_open_and_lock (mu_mailbox_t mbox, int flags)
return MU_ERR_FAILURE;
}
+ if (lock)
+ {
+ status = mu_locker_get_flags (lock, &flags);
+ if (status)
+ {
+ mu_diag_funcall (MU_DIAG_ERROR, "mu_locker_get_flags", urlstr,
+ status);
+ return MU_ERR_FAILURE;
+ }
+ if (flags & MU_LOCKER_NULL)
+ lock = NULL;
+ }
+
if (!lock && manlock_mandatory_locking && manlock_lock_dir)
{
char *fname = NULL;
--
cgit v1.0-41-gc330