From: Ken Brown Date: Sun, 17 Sep 2017 02:04:12 +0000 (-0400) Subject: cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cwd X-Git-Tag: newlib-snapshot-20171222~148 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=571b7689bb690148b9747a125ff2db1d5accb561;p=newlib-cygwin.git cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cwd Fix all callers. --- diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 08cc7ea92..453e79b16 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -498,7 +498,7 @@ format_process_cwd (void *data, char *&destbuf) cfree (destbuf); destbuf = NULL; } - destbuf = p->cwd (fs); + destbuf = p ? p->cwd (fs) : NULL; if (!destbuf || !*destbuf) { destbuf = cstrdup (""); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 9fe1b3a88..c28158168 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -930,7 +930,7 @@ char * _pinfo::cwd (size_t& n) { char *s = NULL; - if (!this || !pid) + if (!pid) return NULL; if (ISSTATE (this, PID_NOTCYGWIN)) {