diff --git a/src/gmnlm.c b/src/gmnlm.c

index 5671394f01788abfa991400576fbc6fd2f4725be..99446e3d67bc1c8db7e8ddfcd613b6dce9ad68c0 100644

--- a/src/gmnlm.c

+++ b/src/gmnlm.c

@@ -772,7 +772,7 @@ if (res != GEMINI_OK) {

fprintf(stderr, "Error: %s\n",

gemini_strerr(res, &resp));

} else {

- close(mkstemp(tempfile));

+ tmpnam(tempfile);

download_resp(browser->tty, resp, tempfile, url);

}

gemini_response_finish(&resp);