summaryrefslogtreecommitdiff
path: root/psutil/_psutil_sunos.c
diff options
context:
space:
mode:
authorwiggin15 <wiggin15@yahoo.com>2017-09-25 18:53:46 +0300
committerGiampaolo Rodola <g.rodola@gmail.com>2017-09-25 23:53:46 +0800
commit8aa64713c634a5d31774cac3b224308a0edeb083 (patch)
tree87dfcf2104ea24b4a858dadc74df6caa03cd478c /psutil/_psutil_sunos.c
parentc4c6e22ca4dad687d2a8505f9e0207d8ecd64358 (diff)
downloadpsutil-8aa64713c634a5d31774cac3b224308a0edeb083.tar.gz
Solaris: fix compilation warnings (#1131)
Diffstat (limited to 'psutil/_psutil_sunos.c')
-rw-r--r--psutil/_psutil_sunos.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c
index 12caaec7..56ec002a 100644
--- a/psutil/_psutil_sunos.c
+++ b/psutil/_psutil_sunos.c
@@ -9,13 +9,13 @@
* this in Cython which I later on translated in C.
*/
-// fix compilation issue on SunOS 5.10, see:
-// https://github.com/giampaolo/psutil/issues/421
-// https://github.com/giampaolo/psutil/issues/1077
-// http://us-east.manta.joyent.com/jmc/public/opensolaris/ARChive/PSARC/2010/111/materials/s10ceval.txt
-//
-// Because LEGACY_MIB_SIZE defined in the same file there is no way to make autoconfiguration =\
-//
+/* fix compilation issue on SunOS 5.10, see:
+ * https://github.com/giampaolo/psutil/issues/421
+ * https://github.com/giampaolo/psutil/issues/1077
+ * http://us-east.manta.joyent.com/jmc/public/opensolaris/ARChive/PSARC/2010/111/materials/s10ceval.txt
+ *
+ * Because LEGACY_MIB_SIZE defined in the same file there is no way to make autoconfiguration =\
+*/
#define NEW_MIB_COMPLIANT 1
#define _STRUCTURED_PROC 1
@@ -126,9 +126,9 @@ psutil_proc_name_and_args(PyObject *self, PyObject *args) {
char path[1000];
psinfo_t info;
const char *procfs_path;
- PyObject *py_name;
- PyObject *py_args;
- PyObject *py_retlist;
+ PyObject *py_name = NULL;
+ PyObject *py_args = NULL;
+ PyObject *py_retlist = NULL;
if (! PyArg_ParseTuple(args, "is", &pid, &procfs_path))
return NULL;
@@ -328,7 +328,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);
@@ -832,7 +832,7 @@ psutil_proc_memory_maps(PyObject *self, PyObject *args) {
pr_addr_sz = p->pr_vaddr + p->pr_size;
// perms
- sprintf(perms, "%c%c%c%c%c%c", p->pr_mflags & MA_READ ? 'r' : '-',
+ sprintf(perms, "%c%c%c%c", p->pr_mflags & MA_READ ? 'r' : '-',
p->pr_mflags & MA_WRITE ? 'w' : '-',
p->pr_mflags & MA_EXEC ? 'x' : '-',
p->pr_mflags & MA_SHARED ? 's' : '-');