]> granicus.if.org Git - php/commitdiff
This fixes the notorious "mode 'c' fails" bug (see bugs - 10380, 10798, 11732). The...
authorGavin Sherry <swm@php.net>
Sat, 12 Jan 2002 07:22:27 +0000 (07:22 +0000)
committerGavin Sherry <swm@php.net>
Sat, 12 Jan 2002 07:22:27 +0000 (07:22 +0000)
ext/dba/dba_db3.c

index 57505b255f278e201abb6d3c3ad2753d292ecee3..abe3b514ed02370e9a6edc7c49eb005729ccf081 100644 (file)
@@ -49,13 +49,15 @@ DBA_OPEN_FUNC(db3)
        int gmode = 0;
        int filemode = 0644;
        struct stat check_stat;
+       int s = VCWD_STAT(info->path, &check_stat);
 
        type =  info->mode == DBA_READER ? DB_UNKNOWN :
                info->mode == DBA_TRUNC ? DB_BTREE :
-               VCWD_STAT(info->path, &check_stat) ? DB_BTREE : DB_UNKNOWN;
+               s? DB_BTREE : DB_UNKNOWN;
          
        gmode = info->mode == DBA_READER ? DB_RDONLY :
-               info->mode == DBA_CREAT  ? DB_CREATE : 
+               (info->mode == DBA_CREAT && s) ? DB_CREATE : 
+               (info->mode == DBA_CREAT && !s) ? 0 :
                info->mode == DBA_WRITER ? 0         : 
                info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;