patch fixing profile writing

mehmet yasar myasar at
Thu Jan 3 08:14:59 CST 2002

it may not be the best solution ...

Bug Description:
Reading an ini file works perfectly but whenever a key is modified
the file written is incorrect (since this forces flushing to disk) :
the actual code adds empty sections ([]) to the file.

Cause: (see wine/files/profile.c):
The first section created by PROFILE_Load() (which reads the
ini file) is an empty one (first_section->name[0]=0), and PROFILE_Save()
saves this to disk.

Do not save empty sections :

diff -ur wine-20011108/files/profile.c mywine/files/profile.c
--- wine-20011108/files/profile.c    Thu Jan  3 14:13:30 2002
+++ mywine/files/profile.c    Thu Jan  3 14:41:56 2002
@@ -145,7 +145,7 @@

     for ( ; section; section = section->next)
-        if (section->name) fprintf( file, "\r\n[%s]\r\n", section->name );
+        if (section->name && section->name[0]) fprintf( file, 
"\r\n[%s]\r\n", section->name );
         for (key = section->key; key; key = key->next)
             fprintf( file, "%s", key->name );

Win2K and Win98 allows the creation of empty sections ([]), this is not
handled by my patch nor by the actual version of wine (bugguy).
I have not seen any application relying on this feature ...

Mehmet YASAR

More information about the wine-patches mailing list