[calls] network-watch: Only g_set_error if error is not NULL



commit ab20b6b8e34fc2e17a05204b35923896fc7ef591
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Thu Sep 16 15:51:35 2021 +0200

    network-watch: Only g_set_error if error is not NULL

 src/calls-network-watch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/calls-network-watch.c b/src/calls-network-watch.c
index e1111c4b..d619da83 100644
--- a/src/calls-network-watch.c
+++ b/src/calls-network-watch.c
@@ -399,7 +399,7 @@ calls_network_watch_initable_init (GInitable    *initable,
   gboolean ret = FALSE;
 
   self->fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
-  if (self->fd == -1) {
+  if (self->fd == -1 && error) {
     int errsv = errno;
     g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
                  "Failed to create netlink socket: %d", errsv);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]