r19076 - gnucash/trunk/src/libqof/qof - Add .log extension to qof_log filename while creating the temporary file.

Geert Janssens gjanssens at code.gnucash.org
Tue Apr 27 11:23:05 EDT 2010


Author: gjanssens
Date: 2010-04-27 11:23:05 -0400 (Tue, 27 Apr 2010)
New Revision: 19076
Trac: http://svn.gnucash.org/trac/changeset/19076

Modified:
   gnucash/trunk/src/libqof/qof/qoflog.c
Log:
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.

Modified: gnucash/trunk/src/libqof/qof/qoflog.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qoflog.c	2010-04-27 12:12:21 UTC (rev 19075)
+++ gnucash/trunk/src/libqof/qof/qoflog.c	2010-04-27 15:23:05 UTC (rev 19076)
@@ -162,7 +162,7 @@
         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 @@
              * 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



More information about the gnucash-changes mailing list