Switching to Cywin-only PIDs introduced a new problem when collecting Cygwin processes for `ps -W': A process can show up multiple times again, if the Cygwin procinfo has been opened for a just execing process. The execed process then shows up twice, once as Cygwin process, but with the wrong Windows PID of the execing process, once as Windows-only process. The mechanism used to exclude these stray processes didn't work with the new Cygwin pid handling anymore. To fix this * check if the incoming Windows PID is the same as the PID in the procinfo. If not, we have the PID of the execing process while procinfo was already changed, * always check if the process has already been handled, not only for processes we got a procinfo for, * simplify adding pid to pidlist since pid is now always correct. While at it, fix comments and comment formatting. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cygwin documentation is available on the net at https://cygwin.com You might especially be interested in https://cygwin.com/faq/faq.html#faq.programming.building-cygwin