This is the mail archive of the cygwin-cvs@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[newlib-cygwin] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cmdline


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

commit 911f7d628d06b15c79524020eed2d4fc8f2eb1ae
Author: Ken Brown <kbrown@cornell.edu>
Date:   Sat Sep 16 22:04:13 2017 -0400

    cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cmdline
    
    Fix all callers.

Diff:
---
 winsup/cygwin/external.cc         | 2 +-
 winsup/cygwin/fhandler_process.cc | 2 +-
 winsup/cygwin/pinfo.cc            | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
index c81bdc0..6aae32a 100644
--- a/winsup/cygwin/external.cc
+++ b/winsup/cygwin/external.cc
@@ -339,7 +339,7 @@ cygwin_internal (cygwin_getinfo_types t, ...)
 	  size_t n;
 	  pid_t pid = va_arg (arg, pid_t);
 	  pinfo p (pid);
-	  res = (uintptr_t) p->cmdline (n);
+	  res = (uintptr_t) (p ? p->cmdline (n) : NULL);
 	}
 	break;
       case CW_CHECK_NTSEC:
diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc
index 453e79b..7f122fb 100644
--- a/winsup/cygwin/fhandler_process.cc
+++ b/winsup/cygwin/fhandler_process.cc
@@ -518,7 +518,7 @@ format_process_cmdline (void *data, char *&destbuf)
       cfree (destbuf);
       destbuf = NULL;
     }
-  destbuf = p->cmdline (fs);
+  destbuf = p ? p->cmdline (fs) : NULL;
   if (!destbuf || !*destbuf)
     {
       destbuf = cstrdup ("<defunct>");
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index c281581..e792a0a 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -976,7 +976,7 @@ char *
 _pinfo::cmdline (size_t& n)
 {
   char *s = NULL;
-  if (!this || !pid)
+  if (!pid)
     return NULL;
   if (ISSTATE (this, PID_NOTCYGWIN))
     {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]