summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:37 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:34:37 -0400
commit10f5b47dc7c1cf2b9a00991629f43652710322d3 (patch)
tree3b727a16f652b8042d573e90f003868ffb3b56c7 /main/streams/plain_wrapper.c
parent0e920280a2e04b110827bb766b9f29e3d581c4ee (diff)
downloadphp-10f5b47dc7c1cf2b9a00991629f43652710322d3.tar.gz
Imported Upstream version 5.0.5upstream/5.0.5
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index 49566d4bb..74f92d17e 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: plain_wrapper.c,v 1.39.2.3 2004/10/28 05:05:39 tony2001 Exp $ */
+/* $Id: plain_wrapper.c,v 1.39.2.7 2005/05/24 10:14:05 tony2001 Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -155,6 +155,7 @@ PHPAPI php_stream *_php_stream_fopen_tmpfile(int dummy STREAMS_DC TSRMLS_DC)
php_stream *stream = php_stream_fopen_from_fd_rel(fd, "r+b", NULL);
if (stream) {
php_stdio_stream_data *self = (php_stdio_stream_data*)stream->abstract;
+ stream->wrapper = &php_plain_files_wrapper;
self->temp_file_name = opened_path;
self->lock_flag = LOCK_UN;
@@ -461,6 +462,9 @@ static int php_stdiop_cast(php_stream *stream, int castas, void **ret TSRMLS_DC)
/* we were opened as a plain file descriptor, so we
* need fdopen now */
data->file = fdopen(data->fd, stream->mode);
+ if (data->file == NULL) {
+ return FAILURE;
+ }
}
*(FILE**)ret = data->file;
@@ -578,7 +582,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
return 0;
}
- if (!flock(fd, value) || (errno == EWOULDBLOCK && value & LOCK_NB)) {
+ if (!flock(fd, value)) {
data->lock_flag = value;
return 0;
} else {