aboutsummaryrefslogtreecommitdiff
path: root/common/log.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2016-05-02 13:09:28 -0400
committerDrew DeVault <sir@cmpwn.com>2016-05-02 13:09:28 -0400
commit8a6b64e47109db52c74d0347ac7659e94a352ae6 (patch)
treee7eaf9e7eefb93f116f19a94e0397ca0cedd2efc /common/log.c
parent70ca8b6041ec29b9390bb749e348534b4b554a22 (diff)
parentf53ddbe800f269f36f5a69c3ec07523d319dc699 (diff)
Merge pull request #634 from 1ace/fix/log-double-close
Fix double-close in error_handler()
Diffstat (limited to 'common/log.c')
-rw-r--r--common/log.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/common/log.c b/common/log.c
index c68f0516..c5c9f3a6 100644
--- a/common/log.c
+++ b/common/log.c
@@ -145,7 +145,6 @@ void error_handler(int sig) {
size_t bt_len;
char maps_file[256];
char maps_buffer[1024];
- FILE *maps;
sway_log(L_ERROR, "Error: Signal %d. Printing backtrace", sig);
bt_len = backtrace(array, max_lines);
@@ -163,11 +162,10 @@ void error_handler(int sig) {
sway_log(L_ERROR, "Maps:");
pid_t pid = getpid();
if (snprintf(maps_file, 255, "/proc/%zd/maps", (size_t)pid) < 255) {
- maps = fopen(maps_file, "r");
+ FILE *maps = fopen(maps_file, "r");
while (!feof(maps)) {
char *m = read_line_buffer(maps, maps_buffer, 1024);
if (!m) {
- fclose(maps);
sway_log(L_ERROR, "Unable to allocate memory to show maps");
break;
}