From: Marcus Boerger Date: Mon, 11 Nov 2002 12:04:12 +0000 (+0000) Subject: -fix file open mode when modifier 'd' is used X-Git-Tag: php-4.3.0RC1~119 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4e57b182e38638af436c32f7674c4ef31428d2d;p=php -fix file open mode when modifier 'd' is used #Add my name to authors --- 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 | + | Authors: Sascha Schumann | + | Marcus Boerger | +----------------------------------------------------------------------+ */ @@ -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 */