Attached is a test program I just put together which does about what Jean-Louis specified above (with the addition of some closed fd's). This works fine on my mac, which is the closest approximation to OpenBSD I have access to at the moment. How does it work on 4.5?
The file-descriptor gymnastics that amandad performs is pretty crazy, so it's quite possible I've misread the code and it's doing something stupid, but please let me know what this test program does. Second, in Jean-Louis' minimal patch, can you change it to read g_debug("first, fcntl returns %d; O_NONBLOCK=%d", fcntl(datafd, F_GETFL, 0), O_NONBLOCK); g_debug("and then fcntl returns %d; O_NONBLOCK=%d", fcntl(datafd, F_GETFL, 0), O_NONBLOCK); and let me know what the corresponding lines in the debug file say? It will be interesting to know if the descriptor flags have O_NONBLOCK set either time. We'll get to the bottom of this :) Dustin -- Open Source Storage Engineer http://www.zmanda.com
test.c
Description: Binary data