| 388 | */ |
| 389 | |
| 390 | int /* O - 0 on success, -1 on failure */ |
| 391 | cupsdEndProcess(int pid, /* I - Process ID */ |
| 392 | int force) /* I - Force child to die */ |
| 393 | { |
| 394 | cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdEndProcess(pid=%d, force=%d)", pid, |
| 395 | force); |
| 396 | |
| 397 | if (!pid) |
| 398 | return (0); |
| 399 | |
| 400 | if (!RunUser) |
| 401 | { |
| 402 | /* |
| 403 | * When running as root, cupsd puts child processes in their own process |
| 404 | * group. Using "-pid" sends a signal to all processes in the group. |
| 405 | */ |
| 406 | |
| 407 | pid = -pid; |
| 408 | } |
| 409 | |
| 410 | if (force) |
| 411 | return (kill(pid, SIGKILL)); |
| 412 | else |
| 413 | return (kill(pid, SIGTERM)); |
| 414 | } |
| 415 | |
| 416 | |
| 417 | /* |
no test coverage detected