summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2002-11-11 12:04:12 +0000
committerMarcus Boerger <helly@php.net>2002-11-11 12:04:12 +0000
commitc4e57b182e38638af436c32f7674c4ef31428d2d (patch)
treeee2474992c5b00660fb204bd5f30450269a834b5
parentdcc7fc16b6b5e546290001b798ddc1bcf3492f8f (diff)
downloadphp-git-c4e57b182e38638af436c32f7674c4ef31428d2d.tar.gz
-fix file open mode when modifier 'd' is used
#Add my name to authors
-rw-r--r--ext/dba/dba.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 6384c5c81b..f05a67b96d 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -12,7 +12,8 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Author: Sascha Schumann <sascha@schumann.cx> |
+ | Authors: Sascha Schumann <sascha@schumann.cx> |
+ | Marcus Boerger <helly@php.net> |
+----------------------------------------------------------------------+
*/
@@ -315,7 +316,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
int i;
int lock_mode, lock_flag, lock_dbf = 0;
char *file_mode;
- char mode[4], *pmode;
+ char mode[4], *pmode, *lock_file_mode;
if(ac < 3) {
WRONG_PARAM_COUNT;
@@ -452,11 +453,14 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
info->argv = args + 3;
if (lock_mode) {
- if (lock_dbf)
+ if (lock_dbf) {
info->lock.name = estrdup(info->path);
- else
+ lock_file_mode = file_mode;
+ } else {
spprintf(&info->lock.name, 0, "%s.lck", info->path);
- info->lock.fp = php_stream_open_wrapper(info->lock.name, "a+b", STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL);
+ lock_file_mode = "a+b";
+ }
+ info->lock.fp = php_stream_open_wrapper(info->lock.name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL);
if (!info->lock.fp) {
dba_close(info TSRMLS_CC);
/* stream operation already wrote an error message */