diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index bead85bf8..d002268ed 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -1443,10 +1443,10 @@ winpids::add (DWORD& nelem, bool winpid, DWORD pid) perform_copy = onreturn ? make_copy : true; p.init (cygpid, PID_PROCINFO | pinfo_access, NULL); - /* Did we catch the process during exec? Try to fix. */ - if (p && p->dwProcessId != pid) - pid = p->dwProcessId; } + /* Did we catch the process during exec? Try to fix. */ + if (p && p->dwProcessId != pid) + pid = p->dwProcessId; /* If we're just looking for winpids then don't do any special cygwin "stuff* */ if (winpid) diff --git a/winsup/cygwin/release/3.0.6 b/winsup/cygwin/release/3.0.6 new file mode 100644 index 000000000..14a83290e --- /dev/null +++ b/winsup/cygwin/release/3.0.6 @@ -0,0 +1,14 @@ +What's new: +----------- + + +What changed: +------------- + + +Bug Fixes +--------- + +- Fix the problem that `ps' or `pstree' may show up in their own + output twice. + Addresses: Report on IRC diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 4e549f7d4..579b3c9c3 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -727,16 +727,15 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, myself->dwProcessId = pi.dwProcessId; strace.execing = 1; myself.hProcess = hExeced = pi.hProcess; + HANDLE old_winpid_hdl = myself.shared_winpid_handle (); if (!real_path.iscygexec ()) { /* If the child process is not a Cygwin process, we have to - create a new winpid symlink and drop the old one on - behalf of the child process not being able to do this - by itself. */ - HANDLE old_winpid_hdl = myself.shared_winpid_handle (); + create a new winpid symlink on behalf of the child process + not being able to do this by itself. */ myself.create_winpid_symlink (); - NtClose (old_winpid_hdl); } + NtClose (old_winpid_hdl); real_path.get_wide_win32_path (myself->progname); // FIXME: race? sigproc_printf ("new process name %W", myself->progname); if (!iscygwin ())