]> granicus.if.org Git - php/commitdiff
MFB: Fix ftruncate() with negative size
authorHannes Magnusson <bjori@php.net>
Thu, 16 Nov 2006 16:08:09 +0000 (16:08 +0000)
committerHannes Magnusson <bjori@php.net>
Thu, 16 Nov 2006 16:08:09 +0000 (16:08 +0000)
main/streams/plain_wrapper.c

index 36a055e8fb2e2d4f8f25172876eaacf6167c6486..1b9e1c2501244759e7ebbcbcece34a551d0679ba 100644 (file)
@@ -765,7 +765,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
                                        return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
 
                                case PHP_STREAM_TRUNCATE_SET_SIZE:
-                                       return ftruncate(fd, *(size_t*)ptrparam) == 0 ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR;
+                                       return ftruncate(fd, *(ptrdiff_t*)ptrparam) == 0 ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR;
                        }
                        
                default: