Apply FreeBSD patch.

References:
- https://android-review.googlesource.com/#/c/100271/
- http://zewaren.net/site/?q=node/125