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

usr.sbin/rad/engine.c
usr.sbin/rad/frontend.c

index ceb11d5..1205509 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: engine.c,v 1.21 2022/10/15 13:26:15 florian Exp $     */
+/*     $OpenBSD: engine.c,v 1.22 2023/12/14 11:09:34 claudio Exp $     */
 
 /*
  * Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -304,7 +304,7 @@ engine_dispatch_main(int fd, short event, void *bula)
                                fatalx("%s: received unexpected imsg fd "
                                    "to engine", __func__);
 
-                       if ((fd = imsg.fd) == -1)
+                       if ((fd = imsg_get_fd(&imsg)) == -1)
                                fatalx("%s: expected to receive imsg fd to "
                                   "engine but didn't receive any", __func__);
 
index 66ebf0c..daeb49d 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: frontend.c,v 1.42 2022/12/28 21:30:18 jmc Exp $       */
+/*     $OpenBSD: frontend.c,v 1.43 2023/12/14 11:09:34 claudio Exp $   */
 
 /*
  * Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -339,7 +339,7 @@ frontend_dispatch_main(int fd, short event, void *bula)
                        if (iev_engine)
                                fatalx("%s: received unexpected imsg fd to "
                                    "frontend", __func__);
-                       if ((fd = imsg.fd) == -1)
+                       if ((fd = imsg_get_fd(&imsg)) == -1)
                                fatalx("%s: expected to receive imsg fd to "
                                   "frontend but didn't receive any",
                                   __func__);
@@ -465,7 +465,7 @@ frontend_dispatch_main(int fd, short event, void *bula)
                        nconf = NULL;
                        break;
                case IMSG_ICMP6SOCK:
-                       if ((icmp6sock = imsg.fd) == -1)
+                       if ((icmp6sock = imsg_get_fd(&imsg)) == -1)
                                fatalx("%s: expected to receive imsg "
                                    "ICMPv6 fd but didn't receive any",
                                    __func__);
@@ -479,7 +479,7 @@ frontend_dispatch_main(int fd, short event, void *bula)
                        if (routesock != -1)
                                fatalx("%s: received unexpected routesock fd",
                                    __func__);
-                       if ((routesock = imsg.fd) == -1)
+                       if ((routesock = imsg_get_fd(&imsg)) == -1)
                                fatalx("%s: expected to receive imsg "
                                    "routesocket fd but didn't receive any",
                                    __func__);
@@ -490,7 +490,7 @@ frontend_dispatch_main(int fd, short event, void *bula)
                        frontend_startup();
                        break;
                case IMSG_CONTROLFD:
-                       if ((fd = imsg.fd) == -1)
+                       if ((fd = imsg_get_fd(&imsg)) == -1)
                                fatalx("%s: expected to receive imsg "
                                    "control fd but didn't receive any",
                                    __func__);