| 206 | } |
| 207 | |
| 208 | static pid_t |
| 209 | get_pid(int fd, int *err) |
| 210 | { |
| 211 | int bytes_read; |
| 212 | char buf[32]; |
| 213 | pid_t pid; |
| 214 | |
| 215 | bytes_read = read (fd, buf, sizeof (buf) - 1); |
| 216 | if (bytes_read > 0) { |
| 217 | buf[bytes_read] = '\0'; |
| 218 | pid = (pid_t)strtol (buf, (char **) NULL, 10); |
| 219 | } else { |
| 220 | pid = -1; |
| 221 | *err = bytes_read ? errno : EINVAL; |
| 222 | } |
| 223 | return pid; |
| 224 | } |
| 225 | |
| 226 | /* end of uucplock.c */ |
no test coverage detected