nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] dot locking broken?

2015-02-13 03:01:51
I think that when m_mktemp() fails we should fail with
adios(), since there is no way things get magically
better by waiting.

Preliminary patch for mmh: http://thread.gmane.org/gmane.mail.mmh/31

I will have to think about that; just doing that for all callers of m_mktemp()
might be bad since it might cause the wrong code to be set for things like
rcvstore (I should check that).
:
Here's what I'd do:

diff --git a/sbr/lock_file.c b/sbr/lock_file.c
index a8a9811..68205ac 100644
--- a/sbr/lock_file.c
+++ b/sbr/lock_file.c
@@ -561,8 +561,8 @@ lockit (struct lockinfo *li)
     curlock = li->curlock;
 
     if ((tmpfile = m_mktemp(li->tmplock, &fd, NULL)) == NULL) {
-        advise(NULL, "unable to create temporary file in %s", li->tmplock);
-       return -1;
+        adios(NULL, "unable to create temporary file in %s", li->tmplock);
+       /* NOTREACHED */
     }
 
 #if 0

it affects all locking clients, but not other users of m_mktemp().

With a failing setgid() (fixed by another patch already) I am getting:

% inc
inc: unable to set group to 6 setegid: Operation not permitted
inc: unable to create temporary file in /var/mail/,LCK.XXXXXX
inc: unable to set group to 6 setegid: Operation not permitted
%

instead of

% inc
inc: unable to set group to 6 setegid: Operation not permitted
inc: unable to create temporary file in /var/mail/,LCK.XXXXXX
(1 second)
inc: unable to create temporary file in /var/mail/,LCK.XXXXXX
(1 second)
inc: unable to create temporary file in /var/mail/,LCK.XXXXXX
(1 second)
inc: unable to create temporary file in /var/mail/,LCK.XXXXXX
(1 second)
inc: unable to lock and fopen /var/mail/sapern
inc: unable to set group to 6 setegid: Operation not permitted
%

(I changed setgid failure messages in uip/inc.c from adios() to advice() just
to get there).

//Marcin


_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>