summaryrefslogtreecommitdiff
path: root/ext/dba/dba_db4.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2004-05-10 01:42:43 +0000
committerMarcus Boerger <helly@php.net>2004-05-10 01:42:43 +0000
commit3988ee2df902c2e9070f5ad198e6c93f5b54c6e3 (patch)
tree62c844e1708788e698a9dca565e9f66e29b8638a /ext/dba/dba_db4.c
parent5cbb4ab2423592d67cb21aad175d83764e65e2c9 (diff)
downloadphp-git-3988ee2df902c2e9070f5ad198e6c93f5b54c6e3.tar.gz
- Fix problems with c mode
Diffstat (limited to 'ext/dba/dba_db4.c')
-rw-r--r--ext/dba/dba_db4.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c
index 7059f5eee0..34e2af1a1f 100644
--- a/ext/dba/dba_db4.c
+++ b/ext/dba/dba_db4.c
@@ -63,9 +63,13 @@ DBA_OPEN_FUNC(db4)
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 :