From e1eccf9a6be88c93b71e28f24ad7e14bef434142 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 19 Sep 2016 10:34:39 +0200 Subject: [PATCH] zmalloc: Make fp var non local to fix build. --- src/zmalloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zmalloc.c b/src/zmalloc.c index 36725874..22bf84fc 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;