openbsd, osx: fix compilation warning on scandir

The select function takes a const struct on newer OSX versions but it
doesn't on OSX <= 10.7 or OpenBSD.