View | Details | Raw Unified | Return to bug 57685
Collapse All | Expand All

(-)a/modules/generators/mod_cgid.c (-3 / +8 lines)
Lines 1170-1176 static int connect_to_daemon(int *sdptr, request_rec *r, Link Here
1170
                                   "unable to create socket to cgi daemon");
1170
                                   "unable to create socket to cgi daemon");
1171
        }
1171
        }
1172
        if (connect(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0) {
1172
        if (connect(sd, (struct sockaddr *)&unix_addr, sizeof(unix_addr)) < 0) {
1173
            if (errno == ECONNREFUSED && connect_tries < DEFAULT_CONNECT_ATTEMPTS) {
1173
            /* ECONNREFUSED means the listen queue is full; ENOENT means that
1174
             * the cgid server hasn't started up yet */
1175
            if ((errno == ECONNREFUSED || errno == ENOENT)
1176
                    && connect_tries < DEFAULT_CONNECT_ATTEMPTS) {
1174
                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, errno, r,
1177
                ap_log_rerror(APLOG_MARK, APLOG_DEBUG, errno, r,
1175
                              "connect #%d to cgi daemon failed, sleeping before retry",
1178
                              "connect #%d to cgi daemon failed, sleeping before retry",
1176
                              connect_tries);
1179
                              connect_tries);
Lines 1191-1198 static int connect_to_daemon(int *sdptr, request_rec *r, Link Here
1191
                                      close_unix_socket, apr_pool_cleanup_null);
1194
                                      close_unix_socket, apr_pool_cleanup_null);
1192
            break; /* we got connected! */
1195
            break; /* we got connected! */
1193
        }
1196
        }
1194
        /* gotta try again, but make sure the cgid daemon is still around */
1197
        /* gotta try again, but make sure the cgid daemon is still around
1195
        if (kill(daemon_pid, 0) != 0) {
1198
         * If we got ENOENT, that means the cgid daemon hasn't even been
1199
         * started yet, so skip this check */
1200
        if (errno != ENOENT && kill(daemon_pid, 0) != 0) {
1196
            return log_scripterror(r, conf, HTTP_SERVICE_UNAVAILABLE, errno,
1201
            return log_scripterror(r, conf, HTTP_SERVICE_UNAVAILABLE, errno,
1197
                                   "cgid daemon is gone; is Apache terminating?");
1202
                                   "cgid daemon is gone; is Apache terminating?");
1198
        }
1203
        }

Return to bug 57685