]> granicus.if.org Git - php/commitdiff
- restore overwrite feature (regression introduced in 5.2.8)
authorPierre Joye <pajoye@php.net>
Thu, 1 Jan 2009 19:32:45 +0000 (19:32 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 1 Jan 2009 19:32:45 +0000 (19:32 +0000)
ext/zip/lib/zip_open.c

index 10c5e1e6d819c0e007de1121e897de737ab74ac2..0880eef2c6f6429496be05f8ee3fee277adab3bd 100644 (file)
@@ -68,7 +68,10 @@ zip_open(const char *fn, int flags, int *zep)
     
     switch (_zip_file_exists(fn, flags, zep)) {
     case -1:
+                       if (!(flags & ZIP_OVERWRITE)) {
        return NULL;
+                       }
+                       
     case 0:
        return _zip_allocate_new(fn, zep);
     default:
@@ -440,7 +443,7 @@ _zip_file_exists(const char *fn, int flags, int *zep)
     }
     
     if (stat(fn, &st) != 0) {
-       if (flags & ZIP_CREATE)
+       if (flags & ZIP_CREATE || flags & ZIP_OVERWRITE)
            return 0;
        else {
            set_error(zep, NULL, ZIP_ER_OPEN);