helly           Sun May  9 21:47:51 2004 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/dba    dba_db2.c dba_db3.c dba_db4.c 
  Log:
  MFH Fix problems with c mode
  
http://cvs.php.net/diff.php/php-src/ext/dba/dba_db2.c?r1=1.30.2.5&r2=1.30.2.6&ty=u
Index: php-src/ext/dba/dba_db2.c
diff -u php-src/ext/dba/dba_db2.c:1.30.2.5 php-src/ext/dba/dba_db2.c:1.30.2.6
--- php-src/ext/dba/dba_db2.c:1.30.2.5  Thu Nov 13 03:59:16 2003
+++ php-src/ext/dba/dba_db2.c   Sun May  9 21:47:51 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dba_db2.c,v 1.30.2.5 2003/11/13 08:59:16 helly Exp $ */
+/* $Id: dba_db2.c,v 1.30.2.6 2004/05/10 01:47:51 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -53,6 +53,10 @@
        struct stat check_stat;
        int s = VCWD_STAT(info->path, &check_stat);
 
+       if (!s && !check_stat.st_size) {
+               info->mode = DBA_TRUNC; /* force truncate */
+       }
+
        type = info->mode == DBA_READER ? DB_UNKNOWN :
                info->mode == DBA_TRUNC ? DB_BTREE :
                s ? DB_BTREE : DB_UNKNOWN;
http://cvs.php.net/diff.php/php-src/ext/dba/dba_db3.c?r1=1.21.2.7&r2=1.21.2.8&ty=u
Index: php-src/ext/dba/dba_db3.c
diff -u php-src/ext/dba/dba_db3.c:1.21.2.7 php-src/ext/dba/dba_db3.c:1.21.2.8
--- php-src/ext/dba/dba_db3.c:1.21.2.7  Thu Nov 13 03:59:16 2003
+++ php-src/ext/dba/dba_db3.c   Sun May  9 21:47:51 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dba_db3.c,v 1.21.2.7 2003/11/13 08:59:16 helly Exp $ */
+/* $Id: dba_db3.c,v 1.21.2.8 2004/05/10 01:47:51 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -62,9 +62,13 @@
        struct stat check_stat;
        int s = VCWD_STAT(info->path, &check_stat);
 
-       type =  info->mode == DBA_READER ? DB_UNKNOWN :
+       if (!s && !check_stat.st_size) {
+               info->mode = DBA_TRUNC; /* force truncate */
+       }
+
+       type = info->mode == DBA_READER ? DB_UNKNOWN :
                info->mode == DBA_TRUNC ? DB_BTREE :
-               s? DB_BTREE : DB_UNKNOWN;
+               s ? DB_BTREE : DB_UNKNOWN;
          
        gmode = info->mode == DBA_READER ? DB_RDONLY :
                (info->mode == DBA_CREAT && s) ? DB_CREATE : 
http://cvs.php.net/diff.php/php-src/ext/dba/dba_db4.c?r1=1.6.2.5&r2=1.6.2.6&ty=u
Index: php-src/ext/dba/dba_db4.c
diff -u php-src/ext/dba/dba_db4.c:1.6.2.5 php-src/ext/dba/dba_db4.c:1.6.2.6
--- php-src/ext/dba/dba_db4.c:1.6.2.5   Thu Nov 13 03:59:16 2003
+++ php-src/ext/dba/dba_db4.c   Sun May  9 21:47:51 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dba_db4.c,v 1.6.2.5 2003/11/13 08:59:16 helly Exp $ */
+/* $Id: dba_db4.c,v 1.6.2.6 2004/05/10 01:47:51 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -62,9 +62,13 @@
        struct stat check_stat;
        int s = VCWD_STAT(info->path, &check_stat);
 
-       type =  info->mode == DBA_READER ? DB_UNKNOWN :
+       if (!s && !check_stat.st_size) {
+               info->mode = DBA_TRUNC; /* force truncate */
+       }
+
+       type = info->mode == DBA_READER ? DB_UNKNOWN :
                info->mode == DBA_TRUNC ? DB_BTREE :
-               s? DB_BTREE : DB_UNKNOWN;
+               s ? DB_BTREE : DB_UNKNOWN;
          
        gmode = info->mode == DBA_READER ? DB_RDONLY :
                (info->mode == DBA_CREAT && s) ? DB_CREATE : 

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

Reply via email to