** easy case; we're not setuid root, so can drop group privs immediately.
*/
#define TRYDROPGROUPPRIVS() DROPGROUPPRIVS()
-#define DROPGROUPPRIVS() setgid(getgid())
-#define GETGROUPPRIVS() setgid(return_gid)
+#define DROPGROUPPRIVS() \
+ if (setegid(getgid()) != 0) { \
+ advise ("setegid", "unable to set group to %ld", (long) getgid()); \
+ _exit (-1); \
+ }
+#define GETGROUPPRIVS() \
+ if (setegid(return_gid) != 0) { \
+ advise ("setegid", "unable to set group to %ld", (long) return_gid); \
+ _exit (-1); \
+ }
#define SAVEGROUPPRIVS() return_gid = getegid()
#else
/* define *GROUPPRIVS() as null; this avoids having lots of "#ifdef MAILGROUP"s */
/*
** prototypes
*/
-static void inc_done();
+void inc_done();
int
/* copy of mail directory because the static gets overwritten */
char *maildir_copy = NULL;
- atexit(inc_done);
+ if (atexit(inc_done) != 0) {
+ adios(NULL, "atexit failed");
+ }
/*
** absolutely the first thing we do is save our privileges,
if ((maildir_copy = strdup(maildir)) == NULL)
adios(maildir, "error allocating memory to copy maildir");
- create_folder(maildir, noisy ? 0 : 1, done);
+ create_folder(maildir, noisy ? 0 : 1, exit);
if (chdir(maildir) == NOTOK)
adios(maildir, "unable to change directory to");
return 0;
}
-static void
+void
inc_done()
{
if (locked) {