@elextr commented on this pull request.

One new bug and two things I noticed in the original.


In plugins/saveactions.c:

>  {
 	gchar *tmp;
 
+	if (target == NULL)
+	{
+		SETPTR(*target, NULL);

*target is guaranteed to dereference a NULL?????


In plugins/saveactions.c:

>  		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 */
 

If g_mkstemp() returns -1 is the filename valid and usable?


In plugins/saveactions.c:

>  		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 */
 

Also since g_mkstemp() makes a file the now non-temporary file directory gets two files, for example gis_setv00 and gis_setv_00.c.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.