Add .log extension to qof_log filename while creating the temporary file.

This will only be visible on Windows. On all other platforms the logfile is
successfully renamed to the requested name.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@19076 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2010-04-27 15:23:05 +00:00
parent 57a37b9005
commit 7be168dd80

View File

@ -162,7 +162,7 @@ qof_log_init_filename(const gchar* log_filename)
if (fout != NULL && fout != stderr && fout != stdout)
fclose(fout);
fname = g_strconcat(log_filename, ".XXXXXX", NULL);
fname = g_strconcat(log_filename, ".XXXXXX.log", NULL);
if ((fd = g_mkstemp(fname)) != -1)
{
@ -171,6 +171,8 @@ qof_log_init_filename(const gchar* log_filename)
* still isn't open. So we open normally with the file name and that's it. */
fout = fopen(fname, "wb");
#else
/* Windows prevents renaming of open files, so the next command silently fails there
* No problem, the filename on Winows will simply have the random characters */
g_rename(fname, log_filename);
fout = fdopen(fd, "w");
#endif