diff --git a/src/gmnlm.c b/src/gmnlm.c
index 99446e3d67bc1c8db7e8ddfcd613b6dce9ad68c0..f85abfc1357f3a446f8ae7dbe02f0228432f7d60 100644
--- a/src/gmnlm.c
+++ b/src/gmnlm.c
@@ -763,7 +763,7 @@ }
}
if (url[0]) {
fprintf(browser->tty, "=> %s\n", url);
- char tempfile[] = "/tmp/cgmnlm_XXXXXX";
+ char *tempfile;
if (in[0] == 't') {
struct gemini_response resp;
set_url(browser, url, &browser->history);
@@ -772,7 +772,7 @@ if (res != GEMINI_OK) {
fprintf(stderr, "Error: %s\n",
gemini_strerr(res, &resp));
} else {
- tmpnam(tempfile);
+ tempfile = tmpnam(NULL);
download_resp(browser->tty, resp, tempfile, url);
}
gemini_response_finish(&resp);