From da9794e272edbceda7dcc268f1a9c44ce97f73b1 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 17 Jul 2017 18:13:20 +0900 Subject: [PATCH] Fix xmessage handling in assert.cc The return value of the system call is not directly the exit value of the process, but a status that needs to be inspected with some macros. --- src/assert.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/assert.cc b/src/assert.cc index 5f8a3f9d..4b7c180a 100644 --- a/src/assert.cc +++ b/src/assert.cc @@ -32,7 +32,8 @@ bool notify_fatal_error(StringView msg) MB_OKCANCEL | MB_ICONERROR) == IDOK; #elif defined(__linux__) auto cmd = format("xmessage -buttons 'quit:0,ignore:1' '{}'", msg); - return system(cmd.c_str()) == 1; + int status = system(cmd.c_str()); + return (WIFEXITED(status)) ? (WEXITSTATUS(status)) == 1 : false; #endif }