From 703b56a3f22756eac55e0bd7b17d1538de6c8000 Mon Sep 17 00:00:00 2001 From: Eric Faurot Date: Sun, 7 Jun 2009 05:56:26 +0000 Subject: Change the way fds passed over a socket are retreived on the receiving side. Currently the receiver fetches an imsg via imsg_get() and if he expects an fd, he then calls imsg_get_fd() to fetch the next fd queued on the imsgbuf from which the imsg came. This changes hides the fd queueing mechanism to the API user. When closing an imsg with an fd, the message is flagged so that the receiving end knows it must dequeue the fd in imsg_get() and return it with the imsg structure. This way there is no (less) possible screw up from imsg_get_fd() not being called directly after imsg_get() by the user. The retreived imsg is self-contained. ok pyr@, "I like that" henning@ --- usr.sbin/relayd/snmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'usr.sbin/relayd/snmp.c') diff --git a/usr.sbin/relayd/snmp.c b/usr.sbin/relayd/snmp.c index 8dbc6d24a6a..e063168d5f7 100644 --- a/usr.sbin/relayd/snmp.c +++ b/usr.sbin/relayd/snmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmp.c,v 1.6 2009/06/06 05:30:45 eric Exp $ */ +/* $OpenBSD: snmp.c,v 1.7 2009/06/07 05:56:25 eric Exp $ */ /* * Copyright (c) 2008 Reyk Floeter @@ -130,7 +130,7 @@ snmp_getsock(struct imsgev *iev) done = 1; switch (imsg.hdr.type) { case IMSG_SNMPSOCK: - s = imsg_get_fd(&iev->ibuf); + s = imsg.fd; break; default: break; -- cgit v1.2.3