diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-17 22:26:58 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-17 22:26:58 +0000 |
| commit | 48dabe0d7a8a9deeaec69fbed02d039c8d8d3b08 (patch) | |
| tree | 0f74d341a7548939ddf3e9ec69e584e2222dc080 /file.c | |
| parent | 79a34fe313afb844aeea0f1837debac3acc91be8 (diff) | |
| download | ruby-48dabe0d7a8a9deeaec69fbed02d039c8d8d3b08.tar.gz ruby-48dabe0d7a8a9deeaec69fbed02d039c8d8d3b08.tar.xz ruby-48dabe0d7a8a9deeaec69fbed02d039c8d8d3b08.zip | |
* file.c (rb_file_truncate): discard read buffer before truncation.
[ruby-dev:24197]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
| -rw-r--r-- | file.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -67,6 +67,9 @@ char *strrchr _((const char*,const char)); #ifndef HAVE_LSTAT #define lstat(path,st) stat(path,st) #endif +#if !HAVE_FSEEKO && !defined(fseeko) +# define fseeko fseek +#endif VALUE rb_cFile; VALUE rb_mFileTest; @@ -2861,6 +2864,7 @@ rb_file_truncate(obj, len) } f = GetWriteFile(fptr); fflush(f); + fseeko(f, (off_t)0, SEEK_CUR); #ifdef HAVE_TRUNCATE if (ftruncate(fileno(f), NUM2OFFT(len)) < 0) rb_sys_fail(fptr->path); |
