com php-src: Improve conditions and visibility: ext/dba/dba.c
| From: | Anatol Belski | Date: | Sat, 27 May 2017 21:07:49 +0000 |
| Subject: | com php-src: Improve conditions and visibility: ext/dba/dba.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97905@lists.php.net to get a copy of this message | ||
Commit: 7312244034f35354502691f5b7c5b4e32d05a105
Author: Anatol Belski <ab@php.net> Sat, 27 May 2017 23:07:49 +0200
Parents: cebfe63e3b24ea92a1891a840be1481b84579285
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7312244034f35354502691f5b7c5b4e32d05a105
Log:
Improve conditions and visibility
Changed paths:
M ext/dba/dba.c
Diff:
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 754ae10..8f7747c 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -646,6 +646,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
char *lock_name;
#ifdef PHP_WIN32
zend_bool restarted = 0;
+ zend_bool need_creation = 0;
#endif
if (ac < 2) {
@@ -767,10 +768,8 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
break;
case 'c': {
#ifdef PHP_WIN32
- php_stream_statbuf ssb;
- zend_bool need_creation = 0;
-
if (hptr->flags & (DBA_NO_APPEND|DBA_CAST_AS_FD)) {
+ php_stream_statbuf ssb;
need_creation = (SUCCESS != php_stream_stat_path(Z_STRVAL(args[0]), &ssb));
}
#endif
@@ -957,7 +956,7 @@ restart:
int flags = fcntl(info->fd, F_GETFL);
fcntl(info->fd, F_SETFL, flags & ~O_APPEND);
#elif defined(PHP_WIN32)
- } else if (modenr == DBA_CREAT && !restarted) {
+ } else if (modenr == DBA_CREAT && need_creation && !restarted) {
zend_bool close_both;
close_both = (info->fp != info->lock.fp);