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

<p>One new bug and two things I noticed in the original.</p><hr>

<p>In <a href="https://github.com/geany/geany/pull/2769#discussion_r598556012">plugins/saveactions.c</a>:</p>
<pre style='color:#555'>>  {
        gchar *tmp;
 
+       if (target == NULL)
+       {
+               SETPTR(*target, NULL);
</pre>
<p><code>*target</code> is guaranteed to dereference a NULL?????</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2769#discussion_r598559413">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>
<p>If g_mkstemp() returns -1 is the filename valid and usable?</p>

<hr>

<p>In <a href="https://github.com/geany/geany/pull/2769#discussion_r598562475">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>
<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_setv_00.c</code>.</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#pullrequestreview-617313850">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAIOWJ52ZRW5XZJHYR4ALRDTE4HQJANCNFSM4ZSS3CGA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AAIOWJYQPADYQJHSE2XCCY3TE4HQJA5CNFSM4ZSS3CGKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOETFXMOQ.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#pullrequestreview-617313850",
"url": "https://github.com/geany/geany/pull/2769#pullrequestreview-617313850",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>