Use imsg_get_fd() to access the file descriptor passed in the imsg.
authorclaudio <claudio@openbsd.org>
Thu, 14 Dec 2023 11:10:19 +0000 (11:10 +0000)
committerclaudio <claudio@openbsd.org>
Thu, 14 Dec 2023 11:10:19 +0000 (11:10 +0000)
OK tb@

usr.sbin/ldpd/lde.c
usr.sbin/ldpd/ldpe.c

index 4eb4c08..1f41a59 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: lde.c,v 1.76 2023/03/08 04:43:13 guenther Exp $ */
+/*     $OpenBSD: lde.c,v 1.77 2023/12/14 11:10:19 claudio Exp $ */
 
 /*
  * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -452,7 +452,7 @@ lde_dispatch_parent(int fd, short event, void *bula)
                                    "to ldpe", __func__);
                                break;
                        }
-                       if ((fd = imsg.fd) == -1) {
+                       if ((fd = imsg_get_fd(&imsg)) == -1) {
                                log_warnx("%s: expected to receive imsg fd to "
                                    "ldpe but didn't receive any", __func__);
                                break;
index 1e7fde7..b69ec63 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ldpe.c,v 1.81 2023/03/08 04:43:13 guenther Exp $ */
+/*     $OpenBSD: ldpe.c,v 1.82 2023/12/14 11:10:19 claudio Exp $ */
 
 /*
  * Copyright (c) 2013, 2016 Renato Westphal <renato@openbsd.org>
@@ -296,7 +296,7 @@ ldpe_dispatch_main(int fd, short event, void *bula)
                                    "to lde", __func__);
                                break;
                        }
-                       if ((fd = imsg.fd) == -1) {
+                       if ((fd = imsg_get_fd(&imsg)) == -1) {
                                log_warnx("%s: expected to receive imsg fd to "
                                    "lde but didn't receive any", __func__);
                                break;
@@ -340,13 +340,13 @@ ldpe_dispatch_main(int fd, short event, void *bula)
 
                        switch (*socket_type) {
                        case LDP_SOCKET_DISC:
-                               disc_socket = imsg.fd;
+                               disc_socket = imsg_get_fd(&imsg);
                                break;
                        case LDP_SOCKET_EDISC:
-                               edisc_socket = imsg.fd;
+                               edisc_socket = imsg_get_fd(&imsg);
                                break;
                        case LDP_SOCKET_SESSION:
-                               session_socket = imsg.fd;
+                               session_socket = imsg_get_fd(&imsg);
                                break;
                        }
                        break;