1
0
mirror of https://github.com/fluencelabs/redis synced 2025-03-21 18:10:49 +00:00

zmalloc: Make fp var non local to fix build.

This commit is contained in:
antirez 2016-09-19 10:34:39 +02:00
parent 945a2f948e
commit e1eccf9a6b

@ -315,13 +315,14 @@ size_t zmalloc_get_smap_bytes_by_field(char *field, long pid) {
char line[1024]; char line[1024];
size_t bytes = 0; size_t bytes = 0;
int flen = strlen(field); int flen = strlen(field);
FILE *fp;
if (pid == -1) { if (pid == -1) {
FILE *fp = fopen("/proc/self/smaps","r"); fp = fopen("/proc/self/smaps","r");
} else { } else {
char filename[128]; char filename[128];
snprintf(filename,sizeof(filename),"/proc/%ld/smaps",pid); snprintf(filename,sizeof(filename),"/proc/%ld/smaps",pid);
FILE *fp = fopen(filename,"r"); fp = fopen(filename,"r");
} }
if (!fp) return 0; if (!fp) return 0;