Fix compile error on *BSD systems.

Patch by brad@comstyle.com.
Fixes ticket:3845.