in got_opentempfd() don't attempt to unlink the file if mkstemp(3) failed
diff --git a/lib/opentemp.c b/lib/opentemp.c
index 9bc6f86..e998f5b 100644
--- a/lib/opentemp.c
+++ b/lib/opentemp.c
@@ -34,7 +34,8 @@ got_opentempfd(void)
return -1;
fd = mkstemp(name);
- unlink(name);
+ if (fd != -1)
+ unlink(name);
return fd;
}