Changeset 229


Ignore:
Timestamp:
Mar 13, 2007, 7:06:48 PM (17 years ago)
Author:
andersk
Message:
Slay zombie pts processes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/common/oursrc/httpdmods/mod_authz_afsgroup.c

    r56 r229  
    5656    int required_afsgroup = 0;
    5757    register int x;
    58     const char *t, *w;
     58    const char *t;
     59    char *w;
    5960    const apr_array_header_t *reqs_arr = ap_requires(r);
    6061    require_line *reqs;
     
    7879                int pfd[2];
    7980                pid_t cpid;
     81                int status;
    8082                FILE *fp;
    8183                char *line = NULL;
     
    8385                size_t len = 0;
    8486                ssize_t read;
     87                int found = 0;
    8588                w = ap_getword_conf(r->pool, &t);
    8689                if (pipe(pfd) == -1) {
     
    9194                cpid = fork();
    9295                if (cpid == -1) {
     96                    close(pfd[0]);
     97                    close(pfd[1]);
    9398                    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
    9499                                  "fork() failed!");
     
    121126                }
    122127                while ((read = getline(&line, &len, fp)) != -1) {
    123                     if (strcmp(line, buf) == 0) {
    124                         return OK;
    125                     }
     128                    if (strcmp(line, buf) == 0)
     129                        found = 1;
    126130                }
    127131                if (line)
    128132                    free(line);
    129133                fclose(fp);
     134                if (waitpid(cpid, &status, 0) == -1) {
     135                    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
     136                                  "waitpid() failed!");
     137                    return HTTP_INTERNAL_SERVER_ERROR;
     138                }
     139                if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
     140                    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
     141                                  "`pts membership -nameorid %s` failed!",
     142                                  w);
     143                    return HTTP_INTERNAL_SERVER_ERROR;
     144                }
     145                if (found)
     146                    return OK;
    130147            }
    131148        }
Note: See TracChangeset for help on using the changeset viewer.