static apr_status_t proc_kill_internal()

in modules/fcgid/fcgid_proc_unix.c [402:429]


static apr_status_t proc_kill_internal(fcgid_procnode *procnode, int sig)
{
    /* su as root before sending signal, for suEXEC */
    apr_status_t rv;

    if (procnode->proc_id.pid == 0) {
        /* procnode->proc_id.pid be 0 while fcgid_create_privileged_process() fail */
        return APR_SUCCESS;
    }

    if (ap_unixd_config.suexec_enabled && seteuid(0) != 0) {

        /* can't gain privileges to send signal (should not occur); do NOT
         * proceed, as something is broken with current identity
         */
        log_setid_failure("mod_fcgid PM", "effective uid", 0);
        _exit(1);
    }
    rv = apr_proc_kill(&(procnode->proc_id), sig);
    if (ap_unixd_config.suexec_enabled && seteuid(ap_unixd_config.user_id) != 0) {
        /* can't drop privileges after signalling (should not occur); do NOT
         * proceed any further as euid(0)!
         */
        log_setid_failure("mod_fcgid PM", "effective uid", ap_unixd_config.user_id);
        _exit(1);
    }
    return rv;
}