From bb7e40ac9dec7d98f0e9f759dd5b0ff35bcdf6c2 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Thu, 9 Dec 2021 10:13:33 +0100 Subject: [PATCH] mlmmj-send: get an exclusive lock at open time --- src/mlmmj-send.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/mlmmj-send.c b/src/mlmmj-send.c index fd781310..42f1d606 100644 --- a/src/mlmmj-send.c +++ b/src/mlmmj-send.c @@ -625,17 +625,11 @@ int main(int argc, char **argv) /* initialize file with mail to send */ - if((mailfd = open(mailfilename, O_RDWR)) < 0) { + if((mailfd = open(mailfilename, O_RDWR|O_EXLOCK)) < 0) { log_error(LOG_ARGS, "Could not open '%s'", mailfilename); exit(EXIT_FAILURE); } - if(myexcllock(mailfd) < 0) { - log_error(LOG_ARGS, "Could not lock '%s'." - "Mail not sent!", mailfilename); - exit(EXIT_FAILURE); - } - if(fstat(mailfd, &st) < 0) { log_error(LOG_ARGS, "Could not stat mailfd"); exit(EXIT_FAILURE); -- 2.47.3