diff --git a/src/build.c b/src/build.c index 64e0f158ea..6703b16ce5 100644 --- a/src/build.c +++ b/src/build.c @@ -1042,7 +1042,7 @@ static void show_build_result_message(gboolean failure) static void build_exit_cb(GPid child_pid, gint status, gpointer user_data) { - show_build_result_message(!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS); + show_build_result_message(!SPAWN_WIFEXITED(status) || SPAWN_WEXITSTATUS(status) != EXIT_SUCCESS); utils_beep(); build_info.pid = 0; diff --git a/src/search.c b/src/search.c index 74fc9c48f6..abf00aa626 100644 --- a/src/search.c +++ b/src/search.c @@ -1849,11 +1849,11 @@ static void search_finished(GPid child_pid, gint status, gpointer user_data) #ifdef G_OS_UNIX gint exit_status = 1; - if (WIFEXITED(status)) + if (SPAWN_WIFEXITED(status)) { - exit_status = WEXITSTATUS(status); + exit_status = SPAWN_WEXITSTATUS(status); } - else if (WIFSIGNALED(status)) + else if (SPAWN_WIFSIGNALED(status)) { exit_status = -1; g_warning("Find in Files: The command failed unexpectedly (signal received)."); diff --git a/src/spawn.c b/src/spawn.c index 3dd7f996d0..9f22a1a9fe 100644 --- a/src/spawn.c +++ b/src/spawn.c @@ -1164,8 +1164,8 @@ static void print_status(gint status) { fputs("finished, ", stderr); - if (WIFEXITED(status)) - fprintf(stderr, "exit code %d\n", WEXITSTATUS(status)); + if (SPAWN_WIFEXITED(status)) + fprintf(stderr, "exit code %d\n", SPAWN_WEXITSTATUS(status)); else fputs("abnormal termination\n", stderr); } diff --git a/src/spawn.h b/src/spawn.h index d179377191..b4afd9569e 100644 --- a/src/spawn.h +++ b/src/spawn.h @@ -25,12 +25,15 @@ #include #ifdef G_OS_WIN32 -# define WIFEXITED(status) TRUE -# define WEXITSTATUS(status) (status) -# define WIFSIGNALED(status) FALSE +# define SPAWN_WIFEXITED(status) TRUE /**< non-zero if the child exited normally */ +# define SPAWN_WEXITSTATUS(status) (status) /**< exit status of a child if exited normally */ +# define SPAWN_WIFSIGNALED(status) FALSE /**< non-zero if the child exited due to signal */ #else # include # include +# define SPAWN_WIFEXITED(status) WIFEXITED(status) +# define SPAWN_WEXITSTATUS(status) WEXITSTATUS(status) +# define SPAWN_WIFSIGNALED(status) WIFSIGNALED(status) #endif G_BEGIN_DECLS diff --git a/src/tools.c b/src/tools.c index 758c17c5ee..c8ebc9784c 100644 --- a/src/tools.c +++ b/src/tools.c @@ -226,7 +226,7 @@ void tools_execute_custom_command(GeanyDocument *doc, const gchar *command) "Your selection was not changed. Error message: %s"), errors->str); } - else if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) + else if (!SPAWN_WIFEXITED(status) || SPAWN_WEXITSTATUS(status) != EXIT_SUCCESS) { /* TODO maybe include the exit code in the error message */ ui_set_statusbar(TRUE,