From 9815d5c94cda204400b24147d8117409853535e0 Mon Sep 17 00:00:00 2001 From: Sascha Schumann Date: Fri, 22 Dec 2000 19:26:02 +0000 Subject: [PATCH] Signal an error condition, if write was unable to perform the complete operation. --- ext/standard/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index 278282d721d..6eab2d14dbe 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1688,8 +1688,8 @@ PHPAPI int php_copy_file(char *src, char *dest) } srcfile = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, fd_s, 0); if (srcfile != (void *) MAP_FAILED) { - write(fd_t, srcfile, sbuf.st_size); - ret = SUCCESS; + if (write(fd_t, srcfile, sbuf.st_size) == sbuf.st_size) + ret = SUCCESS; munmap(srcfile, sbuf.st_size); goto cleanup; }