helly           Thu Jun 12 15:55:16 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/ext/dba       dba.c 
  Log:
  MFH: Bugfix #2397: dba_open locking error with db3
  
Index: php4/ext/dba/dba.c
diff -u php4/ext/dba/dba.c:1.61.2.16 php4/ext/dba/dba.c:1.61.2.17
--- php4/ext/dba/dba.c:1.61.2.16        Thu May 29 10:16:25 2003
+++ php4/ext/dba/dba.c  Thu Jun 12 15:55:16 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dba.c,v 1.61.2.16 2003/05/29 14:16:25 helly Exp $ */
+/* $Id: dba.c,v 1.61.2.17 2003/06/12 19:55:16 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -642,15 +642,20 @@
                        lock_mode = (lock_flag & DBA_LOCK_WRITER) ? LOCK_EX : 0;
                        file_mode = "r+b";
                        break;
-               case 'n':
-                       modenr = DBA_TRUNC;
-                       lock_mode = (lock_flag & DBA_LOCK_TRUNC) ? LOCK_EX : 0;
-                       file_mode = "w+b";
-                       break;
                case 'c': 
                        modenr = DBA_CREAT; 
                        lock_mode = (lock_flag & DBA_LOCK_CREAT) ? LOCK_EX : 0;
                        file_mode = "a+b";
+                       if (!lock_mode || !lock_dbf) {
+                               break;
+                       }
+                       /* When we lock the db file it will be created before the 
handler
+                        * even tries to open it, hence we must change to truncate 
mode.
+                        */
+               case 'n':
+                       modenr = DBA_TRUNC;
+                       lock_mode = (lock_flag & DBA_LOCK_TRUNC) ? LOCK_EX : 0;
+                       file_mode = "w+b";
                        break;
                default:
                        modenr = 0;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to