summaryrefslogtreecommitdiff
path: root/tui
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-02-08 14:03:49 +0100
committerDan Winship <danw@gnome.org>2014-02-13 11:24:37 -0500
commit64c5395cb1cc9e491b96b6bb86df72cb3c606627 (patch)
treeb642c4b8f2849c7876e495057a623be7a561f14f /tui
parent9c4d86ee8064fa36710b8d2d242d9618d4fc763a (diff)
downloadNetworkManager-64c5395cb1cc9e491b96b6bb86df72cb3c606627.tar.gz
build: improve our use of glib's version macros to catch more bugs
We were setting GLIB_VERSION_MAX_ALLOWED to 2.34, since we provide reimplementations of a few 2.34 functions in nm-glib-compat.h. But this was turning off warnings for the 2.34+ APIs we *didn't* have compat versions of too. Fix this by setting MAX_ALLOWED to 2.32 (same as MIN_REQUIRED), and defining macros to wrap calls to compat-ified functions and disable deprecation warnings around them. This points out several places where we were accidentally using 2.34 APIs without noticing, which need to be fixed now.
Diffstat (limited to 'tui')
-rw-r--r--tui/newt/Makefile.am1
-rw-r--r--tui/newt/nmt-newt-types.h1
-rw-r--r--tui/newt/nmt-newt-utils.c11
3 files changed, 13 insertions, 0 deletions
diff --git a/tui/newt/Makefile.am b/tui/newt/Makefile.am
index c5b295cade..7dc35bb0fb 100644
--- a/tui/newt/Makefile.am
+++ b/tui/newt/Makefile.am
@@ -1,4 +1,5 @@
AM_CPPFLAGS= \
+ -I$(top_srcdir)/include \
$(GLIB_CFLAGS) \
$(NEWT_CFLAGS) \
$(NULL)
diff --git a/tui/newt/nmt-newt-types.h b/tui/newt/nmt-newt-types.h
index c26ff900ef..608f7ff6fa 100644
--- a/tui/newt/nmt-newt-types.h
+++ b/tui/newt/nmt-newt-types.h
@@ -21,6 +21,7 @@
#include <glib-object.h>
#include <newt.h>
+#include "nm-glib-compat.h"
G_BEGIN_DECLS
diff --git a/tui/newt/nmt-newt-utils.c b/tui/newt/nmt-newt-utils.c
index 028c2438c6..10e8484927 100644
--- a/tui/newt/nmt-newt-utils.c
+++ b/tui/newt/nmt-newt-utils.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <stdarg.h>
#include <unistd.h>
+#include <sys/wait.h>
#include <glib/gi18n-lib.h>
@@ -350,11 +351,21 @@ nmt_newt_edit_string (const char *data)
goto done;
}
+#if GLIB_CHECK_VERSION (2, 34, 0)
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (!g_spawn_check_exit_status (status, &error)) {
nmt_newt_message_dialog (_("Editor failed: %s"), error->message);
g_error_free (error);
goto done;
}
+ G_GNUC_END_IGNORE_DEPRECATIONS
+#else
+ if (WIFEXITED (status)) {
+ if (WEXITSTATUS (status) != 0)
+ nmt_newt_message_dialog (_("Editor failed with status %d"), WEXITSTATUS (status));
+ } else if (WIFSIGNALED (status))
+ nmt_newt_message_dialog (_("Editor failed with signal %d"), WTERMSIG (status));
+#endif
if (!g_file_get_contents (filename, &new_data, NULL, &error)) {
nmt_newt_message_dialog (_("Could not re-read file: %s"), error->message);