blockingly waits on the pipe * until a child sends a status code */
| 121 | /* blockingly waits on the pipe |
| 122 | * until a child sends a status code */ |
| 123 | static int wait_status_code(char *code) |
| 124 | { |
| 125 | int rc; |
| 126 | |
| 127 | if (status_pipe[0] == -1) { |
| 128 | LM_DBG("invalid read pipe\n"); |
| 129 | goto error; |
| 130 | } |
| 131 | |
| 132 | retry: |
| 133 | rc = read(status_pipe[0], code, 1); |
| 134 | if (rc < 0) { |
| 135 | if (errno == EINTR) |
| 136 | goto retry; |
| 137 | |
| 138 | LM_ERR("read(1) failed (%d): %d, %s\n", rc, errno, strerror(errno)); |
| 139 | } else { |
| 140 | LM_DBG("read code %d (%d byte)\n", *code, rc); |
| 141 | } |
| 142 | |
| 143 | if (rc == 1) |
| 144 | return 0; |
| 145 | |
| 146 | error: |
| 147 | *code = -1; |
| 148 | return -1; |
| 149 | } |
| 150 | |
| 151 | int wait_for_one_child(void) |
| 152 | { |
no outgoing calls
no test coverage detected