diff options
author | Marcus Boerger <helly@php.net> | 2003-06-12 19:53:40 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2003-06-12 19:53:40 +0000 |
commit | 48cc4a7be62173ae982e68349242966bb92a0544 (patch) | |
tree | 16131ad0960aef2f80deae6cb1cc323b06ba74ed | |
parent | a17c5a5fbcb371a0e4ab1c2d32911b9f612965e4 (diff) | |
download | php-git-48cc4a7be62173ae982e68349242966bb92a0544.tar.gz |
Bugfix #2397: dba_open locking error with db3
-rw-r--r-- | ext/dba/dba.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 7f0121c267..9eb92ac1da 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -636,15 +636,20 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) 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; |