From 62168ef6e12925fa42407f4d888cc140a085d7b8 Mon Sep 17 00:00:00 2001 From: ERAMOTO Masaya Date: Mon, 26 Mar 2018 17:31:13 +0900 Subject: [PATCH] shared/mainloop: Fix overwriting exit status Since mainloop_run() overwrites the exit_status variable even if having called mainloop_{quit,exit_*}(), such as in case executing btmgmt with an invalid command, it is initialized in declaration. --- src/shared/mainloop.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/shared/mainloop.c b/src/shared/mainloop.c index 09c46a79a..e6ab9c43d 100644 --- a/src/shared/mainloop.c +++ b/src/shared/mainloop.c @@ -42,7 +42,7 @@ static int epoll_fd; static int epoll_terminate; -static int exit_status; +static int exit_status = EXIT_SUCCESS; struct mainloop_data { int fd; @@ -141,8 +141,6 @@ int mainloop_run(void) } } - exit_status = EXIT_SUCCESS; - while (!epoll_terminate) { struct epoll_event events[MAX_EPOLL_EVENTS]; int n, nfds; -- 2.47.3