summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2016-09-19 10:34:39 +0200
committerantirez <antirez@gmail.com>2016-09-19 10:34:39 +0200
commite1eccf9a6be88c93b71e28f24ad7e14bef434142 (patch)
tree20400b424353a1ecc157cb4986ac03e8f6f90043
parent945a2f948eb518090325b0ceab92588a905e0f92 (diff)
downloadredis-e1eccf9a6be88c93b71e28f24ad7e14bef434142.tar.gz
zmalloc: Make fp var non local to fix build.
-rw-r--r--src/zmalloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/zmalloc.c b/src/zmalloc.c
index 367258746..22bf84fce 100644
--- a/src/zmalloc.c
+++ b/src/zmalloc.c
@@ -315,13 +315,14 @@ size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
char line[1024];
size_t bytes = 0;
int flen = strlen(field);
+ FILE *fp;
if (pid == -1) {
- FILE *fp = fopen("/proc/self/smaps","r");
+ fp = fopen("/proc/self/smaps","r");
} else {
char filename[128];
snprintf(filename,sizeof(filename),"/proc/%ld/smaps",pid);
- FILE *fp = fopen(filename,"r");
+ fp = fopen(filename,"r");
}
if (!fp) return 0;