cvs: php4 /ext/standard ftp_fopen_wrapper.c http_fopen_wrapper.c /main streams.c
| From: | Ilia Alshanetsky | Date: | Thu, 13 Feb 2003 14:40:17 +0000 |
| Subject: | cvs: php4 /ext/standard ftp_fopen_wrapper.c http_fopen_wrapper.c /main streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-18770@lists.php.net to get a copy of this message | ||
iliaa Thu Feb 13 09:40:17 2003 EDT
Modified files:
/php4/main streams.c
/php4/ext/standard http_fopen_wrapper.c ftp_fopen_wrapper.c
Log:
Added 'x' mode for fopen() used on local files. This mode will create a new
file only if a file does not already exist (O_CREAT|O_EXCL).
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.148 php4/main/streams.c:1.149
--- php4/main/streams.c:1.148 Thu Feb 13 08:40:34 2003
+++ php4/main/streams.c Thu Feb 13 09:40:16 2003
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streams.c,v 1.148 2003/02/13 13:40:34 wez Exp $ */
+/* $Id: streams.c,v 1.149 2003/02/13 14:40:16 iliaa Exp $ */
#define _GNU_SOURCE
#include "php.h"
@@ -1874,6 +1874,9 @@
flags = O_WRONLY;
}
flags |= O_CREAT|O_APPEND;
+ break;
+ case 'x':
+ flags = O_CREAT|O_EXCL;
break;
default:
/* unknown mode */
Index: php4/ext/standard/http_fopen_wrapper.c
diff -u php4/ext/standard/http_fopen_wrapper.c:1.60 php4/ext/standard/http_fopen_wrapper.c:1.61
--- php4/ext/standard/http_fopen_wrapper.c:1.60 Thu Feb 13 08:38:20 2003
+++ php4/ext/standard/http_fopen_wrapper.c Thu Feb 13 09:40:17 2003
@@ -18,7 +18,7 @@
| Wez Furlong <wez@thebrainroom.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: http_fopen_wrapper.c,v 1.60 2003/02/13 13:38:20 wez Exp $ */
+/* $Id: http_fopen_wrapper.c,v 1.61 2003/02/13 14:40:17 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -102,7 +102,7 @@
size_t chunk_size = 0, file_size = 0;
int eol_detect;
- if (strchr(mode, 'a') || strchr(mode, '+') || strchr(mode, 'w')) {
+ if (strpbrk(mode, "awx+")) {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP wrapper does not support
writeable connections.");
return NULL;
}
Index: php4/ext/standard/ftp_fopen_wrapper.c
diff -u php4/ext/standard/ftp_fopen_wrapper.c:1.41 php4/ext/standard/ftp_fopen_wrapper.c:1.42
--- php4/ext/standard/ftp_fopen_wrapper.c:1.41 Tue Dec 31 11:07:41 2002
+++ php4/ext/standard/ftp_fopen_wrapper.c Thu Feb 13 09:40:17 2003
@@ -17,7 +17,7 @@
| Hartmut Holzgraefe <hholzgra@php.net> |
+----------------------------------------------------------------------+
*/
-/* $Id: ftp_fopen_wrapper.c,v 1.41 2002/12/31 16:07:41 sebastian Exp $ */
+/* $Id: ftp_fopen_wrapper.c,v 1.42 2003/02/13 14:40:17 iliaa Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -152,7 +152,7 @@
tmp_line[0] = '\0';
- if (strchr(mode, 'a') || strchr(mode, '+')) {
+ if (strpbrk(mode, "a+")) {
php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP does not support simultaneous
read/write connections.");
return NULL;
}