]> www.infradead.org Git - users/dwmw2/crm114-spamd.git/commitdiff
don't fork twice but set $HOME
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 5 Oct 2007 15:20:59 +0000 (17:20 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Fri, 5 Oct 2007 15:20:59 +0000 (17:20 +0200)
crm114-spamd.c

index c03446dd60e0f46ab6d5e550563325d5fc2950c3..43feba149e6056fdbc69d992d92faa41bdb057dd 100644 (file)
@@ -107,12 +107,7 @@ int main(int argc, char **argv)
                ERROR(EX_TEMPFAIL, "user not found");
        if (setuid(ps->pw_uid))
                ERROR(EX_TEMPFAIL, "cannot setuid");
-       pid = fork();
-       if (pid < 0)
-               ERROR(EX_TEMPFAIL, "couldn't fork");
-       if (pid)
-               exit(0);
-       setuid(ps->pw_uid);
+       setenv("HOME", ps->pw_dir, 1);
 
        /* read content-length line */
        read_stdin_line(buf, sizeof(buf));