Portability fixes for OpenBSD. Patch by Aaron Suen.