summaryrefslogtreecommitdiff
path: root/main/streams/plain_wrapper.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2018-10-30 20:42:00 +0100
committerAnatol Belski <ab@php.net>2018-10-30 20:42:00 +0100
commit8827cc34cf8c77828330182ee1e6d0b9438d489c (patch)
tree7d3ef13d5805f48c28ecda981d2ccf8069800e9e /main/streams/plain_wrapper.c
parent2816a3fdfa23cf0711251b8d1e9ffad3d281ea96 (diff)
downloadphp-git-8827cc34cf8c77828330182ee1e6d0b9438d489c.tar.gz
Fixed bug #77081 ftruncate() changes seek pointer in c mode
Diffstat (limited to 'main/streams/plain_wrapper.c')
-rw-r--r--main/streams/plain_wrapper.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c
index fdfc7b4f63..d8e1f517b4 100644
--- a/main/streams/plain_wrapper.c
+++ b/main/streams/plain_wrapper.c
@@ -858,12 +858,13 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
return PHP_STREAM_OPTION_RETURN_ERR;
}
- LARGE_INTEGER old_sz;
- if (!GetFileSizeEx(h, &old_sz)) {
+ LARGE_INTEGER sz, old_sz;
+ sz.QuadPart = 0;
+
+ if (!SetFilePointerEx(h, sz, &old_sz, FILE_CURRENT)) {
return PHP_STREAM_OPTION_RETURN_ERR;
}
- LARGE_INTEGER sz;
#if defined(_WIN64)
sz.HighPart = (new_size >> 32);
sz.LowPart = (new_size & 0xffffffff);