kdc: unused pid element is (pid_t)-1 not zero
commit237cd892d9e9625b135f8c9d078d50dfa44bba91
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 22 Jul 2017 14:39:41 +0000 (22 10:39 -0400)
committerNico Williams <nico@cryptonector.com>
Fri, 28 Jul 2017 03:03:51 +0000 (27 22:03 -0500)
treefd4fa43420c4b6c570459748c8ce741346f2f165
parentb787491942651280a323c28ddfee44dd8aa3e915
kdc: unused pid element is (pid_t)-1 not zero

When the termination of a child process is observed by reap_kid() it
clears the pids[] element by assigning it the invalid pid value
(pid_t)-1. However, start_kdc() assumes that the unused pid[[] element
value is 0.  As a result, each pid[] element's associated child process
can only be restarted once since start_kdc() will not be able to locate
an unused element.

This change alters start_kdc() to initialize all elements of pids[] to
(pid_t)-1 and use that as the marker for unused elements.  By doing so
start_kdc() can properly record child process pids and indefinitely
restart child processes as necessary.

Change-Id: Ia93c9284ab21289994eca7fc9cf1278be7c00683
kdc/connect.c