aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/spawn.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2021-10-07 18:58:21 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2021-10-08 22:11:34 +0200
commit041c5989201218bcf9ce0dae6869013f624f2a41 (patch)
tree1f0e9c68fa20d56978a704a4669b838c0bd8bb96 /src/spawn.c
parent6df603d117049ddb77f769a1ee38a9a4d54b8207 (diff)
downloadsciteco-041c5989201218bcf9ce0dae6869013f624f2a41.tar.gz
prevent deprecation warnings in Glib >= v2.70
Diffstat (limited to 'src/spawn.c')
-rw-r--r--src/spawn.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/spawn.c b/src/spawn.c
index 2d75bd6..085140b 100644
--- a/src/spawn.c
+++ b/src/spawn.c
@@ -35,6 +35,17 @@
#include "error.h"
#include "spawn.h"
+/*
+ * Glib v2.70 deprecates g_spawn_check_exit_status(),
+ * renaming it to g_spawn_check_wait_status().
+ * This leaves no way to work on both new and old versions without warnings.
+ */
+#if GLIB_CHECK_VERSION(2,70,0)
+#define teco_spawn_check_wait_status g_spawn_check_wait_status
+#else
+#define teco_spawn_check_wait_status g_spawn_check_exit_status
+#endif
+
static void teco_spawn_child_watch_cb(GPid pid, gint status, gpointer data);
static gboolean teco_spawn_stdin_watch_cb(GIOChannel *chan,
GIOCondition condition, gpointer data);
@@ -538,9 +549,9 @@ teco_spawn_child_watch_cb(GPid pid, gint status, gpointer data)
/*
* teco_spawn_stdout_watch_cb() might have set the error.
*/
- if (!teco_spawn_ctx.error && !g_spawn_check_exit_status(status, &teco_spawn_ctx.error))
- teco_spawn_ctx.rc = teco_spawn_ctx.error->domain == G_SPAWN_EXIT_ERROR
- ? ABS(teco_spawn_ctx.error->code) : TECO_FAILURE;
+ if (!teco_spawn_ctx.error && !teco_spawn_check_wait_status(status, &teco_spawn_ctx.error))
+ teco_spawn_ctx.rc = teco_spawn_ctx.error->domain == G_SPAWN_EXIT_ERROR
+ ? ABS(teco_spawn_ctx.error->code) : TECO_FAILURE;
g_main_loop_quit(teco_spawn_ctx.mainloop);
}