summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-05-13 19:50:11 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2017-05-13 19:50:11 +0200
commit93e224d40ba046cf10be7d7633e055aada81e2a8 (patch)
treef88d15f9a95fa29d4e7e1d11bcadd01519a54a5c
parentdc69559b163289ccead155eb64a25d005d1b99c7 (diff)
downloadpsutil-93e224d40ba046cf10be7d7633e055aada81e2a8.tar.gz
declare vars at the top of the C function
-rw-r--r--psutil/arch/bsd/netbsd_socks.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/psutil/arch/bsd/netbsd_socks.c b/psutil/arch/bsd/netbsd_socks.c
index 2b1a6ae7..8f713055 100644
--- a/psutil/arch/bsd/netbsd_socks.c
+++ b/psutil/arch/bsd/netbsd_socks.c
@@ -117,6 +117,8 @@ psutil_get_files(void) {
int mib[6];
char *buf;
off_t offset;
+ struct kinfo_file *ki = NULL;
+ struct kif *kif = NULL;
mib[0] = CTL_KERN;
mib[1] = KERN_FILE2;
@@ -145,10 +147,10 @@ psutil_get_files(void) {
}
len /= sizeof(struct kinfo_file);
- struct kinfo_file *ki = (struct kinfo_file *)(buf + offset);
+ ki = (struct kinfo_file *)(buf + offset);
for (j = 0; j < len; j++) {
- struct kif *kif = malloc(sizeof(struct kif));
+ kif = malloc(sizeof(struct kif));
kif->kif = &ki[j];
SLIST_INSERT_HEAD(&kihead, kif, kifs);
}
@@ -347,6 +349,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
psutil_kpcblist_init();
if (psutil_get_files() != 0)
goto error;
+
if (psutil_get_info(ALL) != 0)
goto error;