Hello,

after more than a year, I am resending this message I already sent in Feb 2018:


two more weeks have passed, and with the revised patch there was not a single incident with a truncated INI file.

To make applying the patch easier, find attached a patch against version 2.3.4-1.1, which is currently in "testing".

If there is anything else I can help with, please don't hesitate to contact me.


- Ján



--- unixodbc-2.3.4.orig/ini/iniCommit.c
+++ unixodbc-2.3.4/ini/iniCommit.c
@@ -31,7 +31,7 @@
     if (hIni->iniFileType == 0)
     {
 #endif
-        hFile = uo_fopen( hIni->szFileName, "w" );
+        hFile = uo_fopen( hIni->szFileName, "a" );
 #ifdef __OS2__
     }
     else
--- unixodbc-2.3.4.orig/ini/iniOpen.c
+++ unixodbc-2.3.4/ini/iniOpen.c
@@ -234,7 +234,7 @@
             if ( bCreate == TRUE )
             {
                 if ( (*hIni)->iniFileType == 0 )
-                    hFile = uo_fopen( pszFileName, "w+" );
+                    hFile = uo_fopen( pszFileName, "a+" );
                 else
                     hFile = (FILE *)iniOS2Open( pszFileName);
             }
@@ -409,7 +409,7 @@
 
             if ( bCreate == TRUE )
             {
-                hFile = uo_fopen( pszFileName, "w+" );
+                hFile = uo_fopen( pszFileName, "a+" );
             }
         }
 
--- unixodbc-2.3.4.orig/odbcinst/_odbcinst_SystemINI.c
+++ unixodbc-2.3.4/odbcinst/_odbcinst_SystemINI.c
@@ -176,7 +176,7 @@
                else
         {
             /* does not exist so try creating it */
-            hFile = uo_fopen( pszFileName, "w" );
+            hFile = uo_fopen( pszFileName, "a" );
             if ( hFile )
                 uo_fclose( hFile );
             else

Reply via email to