https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d6cf2b781f4e14f81442ee5aaeaea9f6da73199b

commit d6cf2b781f4e14f81442ee5aaeaea9f6da73199b
Author: Corinna Vinschen <cori...@vinschen.de>
Date:   Sat Feb 2 18:11:42 2019 +0100

    Cygwin: pinfo: simplify create_winpid_symlink
    
    The arguments are not used anyway, so drop them.  When called,
    procinfo->dwProcessId is already set right, so we don't have
    to access myself_initial.
    
    Signed-off-by: Corinna Vinschen <cori...@vinschen.de>

Diff:
---
 winsup/cygwin/pinfo.cc | 9 ++++-----
 winsup/cygwin/pinfo.h  | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index c902577..b2bfb2b 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -67,7 +67,7 @@ pinfo::thisproc (HANDLE h)
   procinfo->dwProcessId = myself_initial.pid;
   procinfo->sendsig = myself_initial.sendsig;
   wcscpy (procinfo->progname, myself_initial.progname);
-  create_winpid_symlink (procinfo->pid, procinfo->dwProcessId);
+  create_winpid_symlink ();
   procinfo->exec_sendsig = NULL;
   procinfo->exec_dwProcessId = 0;
   debug_printf ("myself dwProcessId %u", procinfo->dwProcessId);
@@ -303,8 +303,8 @@ cygwin_pid (DWORD dwProcessId)
 
 /* Create "winpid.WINPID" symlinks with the Cygwin PID of that process as
    target.  This is used to find the Cygwin PID for a given Windows WINPID. */
-inline void
-pinfo::create_winpid_symlink (pid_t cygpid, DWORD winpid)
+void
+pinfo::create_winpid_symlink ()
 {
   WCHAR sym_name[24];
   WCHAR pid_name[24];
@@ -312,8 +312,7 @@ pinfo::create_winpid_symlink (pid_t cygpid, DWORD winpid)
   UNICODE_STRING pid_str;
   OBJECT_ATTRIBUTES attr;
 
-  __small_swprintf (sym_name, L"winpid.%u",
-                   procinfo->dwProcessId ?: myself_initial.pid);
+  __small_swprintf (sym_name, L"winpid.%u", procinfo->dwProcessId);
   RtlInitUnicodeString (&sym_str, sym_name);
   __small_swprintf (pid_name, L"%u", procinfo->pid);
   RtlInitUnicodeString (&pid_str, pid_name);
diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h
index a1e5afe..38a34f3 100644
--- a/winsup/cygwin/pinfo.h
+++ b/winsup/cygwin/pinfo.h
@@ -163,7 +163,7 @@ public:
   }
   pinfo (HANDLE, pinfo_minimal&, pid_t);
   void __reg2 thisproc (HANDLE);
-  void create_winpid_symlink (pid_t, DWORD);
+  void create_winpid_symlink ();
   inline void _pinfo_release ();
   void release ();
   bool __reg1 wait ();

Reply via email to