<p></p>
<p><b>@eht16</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2769#discussion_r603633932">plugins/saveactions.c</a>:</p>
<pre style='color:#555'>>              gchar *new_filename;
                gint fd;
                GeanyFiletype *ft = doc->file_type;
 
-               fd = g_file_open_tmp("gis_XXXXXX", &new_filename, NULL);
+               directory = !EMPTY(instantsave_target_dir) ? instantsave_target_dir : g_get_tmp_dir();
+               new_filename = g_build_filename(directory, "gis_XXXXXX", NULL);
+               fd = g_mkstemp(new_filename);
                if (fd != -1)
                        close(fd); /* close the returned file descriptor as we only need the filename */
 
</pre>
<blockquote>
<p>If g_mkstemp() returns -1 is the filename valid and usable?</p>
</blockquote>
<p>As per docs, no. So we handle now errors by showing them to the user and cancelling Instant Save.</p>
<blockquote>
<p>Also since g_mkstemp() makes a file the now non-temporary file directory gets two files, for example <code>gis_setv00</code> and <code>gis_setv00.c</code>.</p>
</blockquote>
<p>Good catch! Fixed by first constructing the final filename and then call <code>g_mkstemp()</code> to have the file created.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/pull/2769#discussion_r603633932">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ5DN2HXHJL7ONG6QPLTGDYD7ANCNFSM4ZSS3CGA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAIOWJYJGM374LMUTVDRUALTGDYD7A5CNFSM4ZSS3CGKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOEUWIRPQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/geany/geany/pull/2769#discussion_r603633932",
"url": "https://github.com/geany/geany/pull/2769#discussion_r603633932",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>