return TRUE;
}
-static void __close_channel_and_sock(struct sock_data* sd)
+static void __close_channel_and_sock(struct sock_data *sd)
{
- INFO("+");
- GError* error = NULL;
+ GError *error = NULL;
if (sd == NULL)
return;
sd->chk_conflict_sd = -1;
}
-static int __open_channel_and_sock(struct sock_data* sd)
+static int __open_channel_and_sock(struct sock_data *sd)
{
- INFO("+");
if (sd == NULL)
return -1;
sd->chk_conflict_sock_io = g_io_channel_unix_new(sd->chk_conflict_sd);
if (sd->chk_conflict_sock_io == NULL) {
INFO("Failed to create channel");
- g_free(sd);
+ close(sd->chk_conflict_sd);
+ sd->chk_conflict_sd = -1;
return -1;
}
+
g_io_channel_set_close_on_unref(sd->chk_conflict_sock_io, TRUE);
- if (G_IO_STATUS_NORMAL != g_io_channel_set_encoding(sd->chk_conflict_sock_io,
- NULL, NULL))
+ if (G_IO_STATUS_NORMAL != g_io_channel_set_encoding(sd->chk_conflict_sock_io, NULL, NULL))
INFO("Failed to set encoding NULL on io channel");
+
if (G_IO_STATUS_NORMAL != g_io_channel_set_flags(sd->chk_conflict_sock_io,
G_IO_FLAG_NONBLOCK, NULL))
INFO("Failed to set flags on io channel");
+
sd->chk_conflict_data_id = g_io_add_watch(sd->chk_conflict_sock_io, G_IO_IN,
__netconfig_check_arp_receive, sd);
DBG("socket %d", sd->chk_conflict_sd);