summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-01-01 10:30:27 +0100
committerThomas Haller <thaller@redhat.com>2020-01-09 14:30:04 +0100
commit8c011d887ff2218fa5773a6d8d7fe217e545e004 (patch)
tree024335e89e2956f91dd0ec17d530cfca4428dfa5
parent9789819a365ff0bdec84de38af00f409c543fae8 (diff)
downloadNetworkManager-8c011d887ff2218fa5773a6d8d7fe217e545e004.tar.gz
all: use nm_g_unix_fd_source_new() instead of g_unix_fd_source_new()
Its source-func argument has the right signature. Otherwise, this is an easy to make mistake.
-rw-r--r--clients/cloud-setup/nm-http-client.c9
-rw-r--r--clients/common/nm-polkit-listener.c26
-rw-r--r--libnm-core/tests/test-general.c17
-rw-r--r--src/nm-connectivity.c8
4 files changed, 37 insertions, 23 deletions
diff --git a/clients/cloud-setup/nm-http-client.c b/clients/cloud-setup/nm-http-client.c
index 943310955a..9ceb26c3b2 100644
--- a/clients/cloud-setup/nm-http-client.c
+++ b/clients/cloud-setup/nm-http-client.c
@@ -5,7 +5,6 @@
#include "nm-http-client.h"
#include <curl/curl.h>
-#include <glib-unix.h>
#include "nm-cloud-setup-utils.h"
@@ -636,8 +635,12 @@ _mhandle_socketfunction_cb (CURL *e_handle, curl_socket_t fd, int what, void *us
condition = 0;
if (condition) {
- priv->mhandle_source_socket = g_unix_fd_source_new (fd, condition);
- g_source_set_callback (priv->mhandle_source_socket, G_SOURCE_FUNC (_mhandle_socket_cb), self, NULL);
+ priv->mhandle_source_socket = nm_g_unix_fd_source_new (fd,
+ condition,
+ G_PRIORITY_DEFAULT,
+ _mhandle_socket_cb,
+ self,
+ NULL);
g_source_attach (priv->mhandle_source_socket, priv->context);
}
}
diff --git a/clients/common/nm-polkit-listener.c b/clients/common/nm-polkit-listener.c
index 6c635e0c0a..58684015c5 100644
--- a/clients/common/nm-polkit-listener.c
+++ b/clients/common/nm-polkit-listener.c
@@ -23,8 +23,8 @@
#include "nm-polkit-listener.h"
#include <gio/gio.h>
-#include <glib-unix.h>
#include <pwd.h>
+#include <fcntl.h>
#include "nm-glib-aux/nm-dbus-aux.h"
#include "nm-glib-aux/nm-secret-utils.h"
@@ -443,12 +443,12 @@ queue_string_to_helper (AuthRequest *request, const char *response)
g_string_append_c (request->out_buffer, '\n');
if (!request->child_stdin_watch_source) {
- request->child_stdin_watch_source = g_unix_fd_source_new (request->child_stdin,
- G_IO_OUT | G_IO_ERR | G_IO_HUP);
- g_source_set_callback (request->child_stdin_watch_source,
- G_SOURCE_FUNC (io_watch_can_write),
- request,
- NULL);
+ request->child_stdin_watch_source = nm_g_unix_fd_source_new (request->child_stdin,
+ G_IO_OUT | G_IO_ERR | G_IO_HUP,
+ G_PRIORITY_DEFAULT,
+ io_watch_can_write,
+ request,
+ NULL);
g_source_attach (request->child_stdin_watch_source,
request->listener->main_context);
}
@@ -570,12 +570,12 @@ begin_authentication (AuthRequest *request)
fd_flags = fcntl (request->child_stdout, F_GETFD, 0);
fcntl (request->child_stdout, F_SETFL, fd_flags | O_NONBLOCK);
- request->child_stdout_watch_source = g_unix_fd_source_new (request->child_stdout,
- G_IO_IN | G_IO_ERR | G_IO_HUP);
- g_source_set_callback (request->child_stdout_watch_source,
- G_SOURCE_FUNC (io_watch_have_data),
- request,
- NULL);
+ request->child_stdout_watch_source = nm_g_unix_fd_source_new (request->child_stdout,
+ G_IO_IN | G_IO_ERR | G_IO_HUP,
+ G_PRIORITY_DEFAULT,
+ io_watch_have_data,
+ request,
+ NULL);
g_source_attach (request->child_stdout_watch_source,
request->listener->main_context);
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
index e1cafb14b4..1bdaf5bd62 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -10,7 +10,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include <glib-unix.h>
#include "nm-std-aux/c-list-util.h"
#include "nm-glib-aux/nm-enum-utils.h"
@@ -8199,8 +8198,12 @@ _test_integrate_cb_idle_2 (gpointer user_data)
g_assert (d->extra_sources[0]);
g_assert (!d->extra_sources[1]);
- extra_source = g_unix_fd_source_new (d->fd_2, G_IO_IN);
- g_source_set_callback (extra_source, G_SOURCE_FUNC (_test_integrate_cb_fd_2), d, NULL);
+ extra_source = nm_g_unix_fd_source_new (d->fd_2,
+ G_IO_IN,
+ G_PRIORITY_DEFAULT,
+ _test_integrate_cb_fd_2,
+ d,
+ NULL);
g_source_attach (extra_source, d->c2);
d->extra_sources[1] = extra_source;
@@ -8294,8 +8297,12 @@ test_integrate_maincontext (gconstpointer test_data)
fd_1 = open ("/dev/null", O_RDONLY | O_CLOEXEC);
g_assert (fd_1 >= 0);
- fd_source_1 = g_unix_fd_source_new (fd_1, G_IO_IN);
- g_source_set_callback (fd_source_1, G_SOURCE_FUNC (_test_integrate_cb_fd_1), &d, NULL);
+ fd_source_1 = nm_g_unix_fd_source_new (fd_1,
+ G_IO_IN,
+ G_PRIORITY_DEFAULT,
+ _test_integrate_cb_fd_1,
+ &d,
+ NULL);
g_source_attach (fd_source_1, c2);
fd_2 = open ("/dev/null", O_RDONLY | O_CLOEXEC);
diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c
index bcafc90893..207af583ce 100644
--- a/src/nm-connectivity.c
+++ b/src/nm-connectivity.c
@@ -515,8 +515,12 @@ multi_socket_cb (CURL *e_handle, curl_socket_t fd, int what, void *userdata, voi
condition = 0;
if (condition) {
- fdp->source = g_unix_fd_source_new (fd, condition);
- g_source_set_callback (fdp->source, G_SOURCE_FUNC (_con_curl_socketevent_cb), fdp, NULL);
+ fdp->source = nm_g_unix_fd_source_new (fd,
+ condition,
+ G_PRIORITY_DEFAULT,
+ _con_curl_socketevent_cb,
+ fdp,
+ NULL);
g_source_attach (fdp->source, NULL);
}
}