Add patch from upstream to use mktemp correctly.

One of the tests used mktemp without a template, which is an error on
NetBSD.  This patch is likely to be committed upstream, but I'm
leaving it here in case not.