Fix: define _LGPL_SOURCE in C files
[lttng-tools.git] / src / common / sessiond-comm / inet.c
index cf06ecb858d2079455c7a009f888435b6532d6c4..2703a666e71e557c10b956bb2c0402d89ca1aec9 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <assert.h>
 #include <limits.h>
 #include <stdio.h>
@@ -305,11 +306,11 @@ struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock)
 
                ret = lttcomm_setsockopt_rcv_timeout(new_fd, timeout);
                if (ret) {
-                       goto error;
+                       goto error_close;
                }
                ret = lttcomm_setsockopt_snd_timeout(new_fd, timeout);
                if (ret) {
-                       goto error;
+                       goto error_close;
                }
        }
 
@@ -319,6 +320,11 @@ struct lttcomm_sock *lttcomm_accept_inet_sock(struct lttcomm_sock *sock)
 end:
        return new_sock;
 
+error_close:
+       if (close(new_fd) < 0) {
+               PERROR("accept inet close fd");
+       }
+
 error:
        free(new_sock);
        return NULL;
This page took 0.023367 seconds and 4 git commands to generate.