Hi, here's a patch proposal for bug #28371. ftruncate() doesn't update file position and all further writes go to the old location. (or is it an undocumented feature?)
-- mg
--- php-5.0.1/main/streams/plain_wrapper.c 2004-07-31 13:00:10.000000000 +0200 +++ php-5.0.1-patch/main/streams/plain_wrapper.c 2004-08-26 01:03:53.328106456 +0200 @@ -732,6 +732,7 @@ return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; case PHP_STREAM_TRUNCATE_SET_SIZE: + stream->position = *(size_t*) ptrparam; return ftruncate(fd, *(size_t*)ptrparam) == 0 ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; }
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php