From a6eff813260b38551ab64ea9afe9638200540a26 Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola Date: Thu, 18 May 2017 20:27:25 +0200 Subject: sunos: fix C compiler warning --- psutil/_psutil_sunos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c index 53f719e4..a53aa16f 100644 --- a/psutil/_psutil_sunos.c +++ b/psutil/_psutil_sunos.c @@ -183,7 +183,7 @@ psutil_proc_cpu_times(PyObject *self, PyObject *args) { */ static PyObject * psutil_proc_cpu_num(PyObject *self, PyObject *args) { - int fd = NULL; + int fd = -1; int pid; char path[1000]; struct prheader header; @@ -248,7 +248,7 @@ psutil_proc_cpu_num(PyObject *self, PyObject *args) { return Py_BuildValue("i", proc_num); error: - if (fd != NULL) + if (fd != -1) close(fd); if (ptr != NULL) free(ptr); -- cgit v1.2.1