diff options
-rw-r--r-- | include/packet.h | 2 | ||||
-rw-r--r-- | src/com-core.c | 6 | ||||
-rw-r--r-- | src/packet.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/include/packet.h b/include/packet.h index 366c7e4..f2cfe49 100644 --- a/include/packet.h +++ b/include/packet.h @@ -377,7 +377,7 @@ extern const int const packet_size(const struct packet *packet); */ extern struct packet *packet_build(struct packet *packet, int offset, void *data, int size); -extern int packet_fd(struct packet *packet); +extern int packet_fd(const struct packet *packet); extern int packet_set_fd(struct packet *packet, int fd); #ifdef __cplusplus diff --git a/src/com-core.c b/src/com-core.c index 208b564..ceec3a7 100644 --- a/src/com-core.c +++ b/src/com-core.c @@ -303,7 +303,7 @@ static gboolean accept_cb(GIOChannel *src, GIOCondition cond, gpointer cbdata) g_io_channel_set_close_on_unref(gio, FALSE); id = g_io_add_watch(gio, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, (GIOFunc)client_cb, cbdata); - if (id <= 0) { + if (id == 0) { GError *err = NULL; ErrPrint("Failed to add IO watch\n"); @@ -373,7 +373,7 @@ EAPI int com_core_server_create(const char *addr, int is_sync, int (*service_cb) g_io_channel_set_close_on_unref(gio, FALSE); id = g_io_add_watch(gio, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, (GIOFunc)accept_cb, cbdata); - if (id <= 0) { + if (id == 0) { GError *err = NULL; ErrPrint("Failed to add IO watch\n"); free(cbdata); @@ -449,7 +449,7 @@ EAPI int com_core_client_create(const char *addr, int is_sync, int (*service_cb) g_io_channel_set_close_on_unref(gio, FALSE); id = g_io_add_watch(gio, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, (GIOFunc)client_cb, cbdata); - if (id <= 0) { + if (id == 0) { GError *err = NULL; ErrPrint("Failed to add IO watch\n"); free(cbdata); diff --git a/src/packet.c b/src/packet.c index cc069e7..c40f78f 100644 --- a/src/packet.c +++ b/src/packet.c @@ -132,7 +132,7 @@ EAPI int packet_set_fd(struct packet *packet, int fd) return 0; } -EAPI int packet_fd(struct packet *packet) +EAPI int packet_fd(const struct packet *packet) { if (!packet || packet->state != VALID || !packet->data) { return -EINVAL; |