summarylogtreecommitdiffstats
path: root/ipv6.patch
blob: 7135ae70830820d17380b1ac334e07b471589bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From ee08a9e1b045e8d2f4f13a0e60c2f603b66b0d69 Mon Sep 17 00:00:00 2001
From: Marc Payne <marc321@gmail.com>
Date: Mon, 6 Jul 2015 02:51:43 -0600
Subject: [PATCH] Close file only if it was successfully opened

If BUILD_IPV6=ON (default), but the user has disabled ipv6 support
in the kernel using the parameter ipv6.disable=1, then conky fails
to open /proc/net/if_inet6. This leads to a segfault when conky
calls fclose(file) regardless. This fix simply moves the fclose call
into the preceding if statement.
---
 src/linux.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/linux.cc b/src/linux.cc
index 847acac..7977fee 100644
--- a/src/linux.cc
+++ b/src/linux.cc
@@ -643,8 +643,8 @@ int update_net_stats(void)
 			}
 			lastv6->next = NULL;
 		}
+		fclose(file);
 	}
-	fclose(file);
 #endif /* BUILD_IPV6 */
 
 	first = 0;