spamass-milt-list
[Top][All Lists]
Advanced

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

Why spamass-milter is not a well-behaved daemon?


From: Michail Vidiassov
Subject: Why spamass-milter is not a well-behaved daemon?
Date: Thu, 16 Oct 2003 12:01:27 +0400 (MSD)

Dear All,

is there any reason for spamass-milter, given -f switch, just forking and
not doing what the other daemons do - detach from terminal, redirect
output to nul, etc?

The other question is why the debuging information is sent to syslog
with priority LOG_ERR?
That seems a little bit to high for debug messages.

                      Sincerely, Michail
PS. To be a good daemon, spamass-milter has to do (after forking)
something like the following:

/* detach from the controlling terminal */
        if (setsid() == -1) {
           fprintf(stderr, "Uh-oh, couldn't create new session!\n");
           exit(errno);
        }

/* change the current working directory to the root */
        (void)chdir("/");

/* redirect standard input, standard output and standard error to /dev/null */
        {
        int fd;
        if ((fd = _open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
                (void)dup2(fd, STDIN_FILENO);
                (void)dup2(fd, STDOUT_FILENO);
                (void)dup2(fd, STDERR_FILENO);
                if (fd > 2)
                        (void)_close(fd);
        }
        }




reply via email to

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