please replace mkostemp by mktemp + open if you want to handle the flags or, like in the patch for 3.7.9 just use mkstemp mkostemp is a gnu addition, non posix, and not available on FreeBSD.
mkstemp is not acceptable, since there was a specific change (O_NOFOLLOW) to fix a CVE. Could someone with freebsd whip up a patch that uses the correct open semantics? I don't have access to freebsd.
Okay, I just went and changed it. If it still fails, please re-open (preferably with a patch).