file only if a file does not already exist (O_CREAT|O_EXCL).
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;
}
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;
}
}
flags |= O_CREAT|O_APPEND;
break;
+ case 'x':
+ flags = O_CREAT|O_EXCL;
+ break;
default:
/* unknown mode */
return FAILURE;