nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] dot locking broken?


From: Marcin Cieslak
Subject: Re: [Nmh-workers] dot locking broken?
Date: Fri, 13 Feb 2015 08:51:13 +0000 (UTC)
User-agent: slrn/0.9.9p1 (FreeBSD)

>> David Levine <address@hidden> wrote:
> Marcin wrote:
>
>> >> David Levine <address@hidden> wrote:
>>
>> Using setegid() is ok according to POSIX.1-2004, it was previously
>> just a BSD extension.
>
> Thanks.  Committed.  I also added a check for success of setegid(),
> and adios() on failure.

We also need this:

diff --git a/uip/inc.c b/uip/inc.c
index b457282..7d12842 100644
--- a/uip/inc.c
+++ b/uip/inc.c
@@ -137,7 +137,7 @@ static gid_t return_gid;
 #define TRYDROPGROUPPRIVS() DROPGROUPPRIVS()
 #define DROPGROUPPRIVS() \
     if (setegid(getgid()) != 0) { \
-        adios ("setegid", "unable to set group to %ld", (long) getgid()); \
+        adios ("setegid", "unable to restore group to %ld", (long) getgid()); \
     }
 #define GETGROUPPRIVS() \
     if (setegid(return_gid) != 0) { \
@@ -959,6 +959,7 @@ skip:
 static void
 inc_done (int status)
 {
+    done = exit;
     if (packfile && pd != NOTOK)
        mbx_close (packfile, pd);
     if (locked)

Otherwise "inc" loops endlessly (just replace setegid() with setgid()
again to test).

(I changed the message to "restore" for better debugging).

//Marcin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]