From 5c584cedf8d3cc192a5d04da3fade7ee63f6bf3a Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Wed, 21 Aug 2013 01:05:05 +0200 Subject: [PATCH] PFS: unblock the child when unsuspending an accept Previously, PFS would incorrectly try to unsuspend the parent (i.e., the listening socket), resulting in the child hanging until the other side performed another action. Test56 started failing on this now. Change-Id: I231ac5481c83ac45951d33aeecc8149273f48b11 --- servers/pfs/uds.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/servers/pfs/uds.c b/servers/pfs/uds.c index f28531b92..34b9d1006 100644 --- a/servers/pfs/uds.c +++ b/servers/pfs/uds.c @@ -398,7 +398,7 @@ int do_accept(message *dev_m_in, message *dev_m_out) int do_connect(message *dev_m_in, message *dev_m_out) { - int minor; + int minor, child; struct sockaddr_un addr; int rc, i, j; @@ -446,26 +446,28 @@ int do_connect(message *dev_m_in, message *dev_m_out) !strncmp(addr.sun_path, uds_fd_table[i].addr.sun_path, UNIX_PATH_MAX)) { - if (uds_fd_table[i].child != -1) { + if ((child = uds_fd_table[i].child) != -1) { /* the server is blocked on accept(2) -- * perform connection to the child */ rc = perform_connection(dev_m_in, dev_m_out, - &addr, minor, uds_fd_table[i].child); + &addr, minor, child); if (rc == OK) { uds_fd_table[i].child = -1; #if DEBUG == 1 - printf("(uds) [%d] {do_connect} revive %d\n", minor, i); + printf("(uds) [%d] {do_connect} revive %d\n", minor, child); #endif /* wake the parent (server) */ - uds_fd_table[i].ready_to_revive = 1; - uds_unsuspend(dev_m_in->m_source, i); + uds_fd_table[child].ready_to_revive = + 1; + uds_unsuspend(dev_m_in->m_source, + child); } return rc; -- 2.44.0