diff --git a/support/nl.c b/support/nl.c index 88babdae391c1b41ad995c9f3c48c697ac0c87ec..4608700cab70becaa820ea74137fc5f7c62b1e4a 100644 --- a/support/nl.c +++ b/support/nl.c @@ -163,7 +163,7 @@ value_to_name (value2name_t *tbl, int value) } #endif /* NL_DEBUG */ -int +gpointer CreateNLSocket (void) { int sock; @@ -177,12 +177,12 @@ CreateNLSocket (void) ret |= O_NONBLOCK; ret = fcntl (sock, F_SETFL, ret); if (ret < 0) - return -1; + return GINT_TO_POINTER (-1); } memset (&sa, 0, sizeof (sa)); if (sock < 0) - return -1; + return GINT_TO_POINTER (-1); sa.nl_family = AF_NETLINK; sa.nl_pid = getpid (); sa.nl_groups = RTMGRP_IPV4_ROUTE | RTMGRP_IPV6_ROUTE | RTMGRP_NOTIFY; @@ -190,9 +190,9 @@ CreateNLSocket (void) * RTMGRP_LINK */ if (bind (sock, (struct sockaddr *) &sa, sizeof (sa)) < 0) - return -1; + return GINT_TO_POINTER (-1); - return sock; + return GINT_TO_POINTER (sock); } int @@ -359,10 +359,10 @@ ReadEvents (gpointer sock, gpointer buffer, gint32 count, gint32 size) return result; } -int +gpointer CloseNLSocket (gpointer sock) { - return close (GPOINTER_TO_INT (sock)); + return GINT_TO_POINTER (close (GPOINTER_TO_INT (sock))); } #else int @@ -377,16 +377,16 @@ ReadEvents (gpointer sock, gpointer buffer, gint32 count, gint32 size) return 0; } -int +gpointer CreateNLSocket (void) { - return -1; + return GINT_TO_POINTER (-1); } -int +gpointer CloseNLSocket (gpointer sock) { - return -1; + return GINT_TO_POINTER (-1); } #endif /* linux/netlink.h + linux/rtnetlink.h */ diff --git a/support/nl.h b/support/nl.h index 4a464266382320eef60f22f052229e9993eb433c..ae9605fd4873cfe47cf4fde127e3c42530630fdf 100644 --- a/support/nl.h +++ b/support/nl.h @@ -3,9 +3,9 @@ #include G_BEGIN_DECLS -int CreateNLSocket (void); +gpointer CreateNLSocket (void); int ReadEvents (gpointer sock, gpointer buffer, gint32 count, gint32 size); -int CloseNLSocket (gpointer sock); +gpointer CloseNLSocket (gpointer sock); G_END_DECLS #endif