From 48dabe0d7a8a9deeaec69fbed02d039c8d8d3b08 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 17 Oct 2004 22:26:58 +0000 Subject: * 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 --- ChangeLog | 21 +++++++++++++-------- file.c | 4 ++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 052acf12a..33ebf34a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,31 +1,36 @@ +Mon Oct 18 07:26:21 2004 Nobuyoshi Nakada + + * file.c (rb_file_truncate): discard read buffer before truncation. + [ruby-dev:24197] + Mon Oct 18 02:11:21 2004 GOTOU Yuuzou - + * lib/webrick/config.rb (WEBrick::Config::General): add default values: - WEBrick::Config[:DoNotReverseLookup] - WEBrick::Config[:RequestCallback] (it used as an alias of :RequestHandler in WEBrick::HTTPServer#run) - WEBrick::Config::FileHandler[:AcceptableLanguages] - + * lib/webrick/httpservlet/filehandler.rb (WEBrick::HTTPServlet::FileHandler#set_filename): search files having suffix of language-name which Accept-Language header field includes if :AcceptableLanguages options is present. - + * lib/webrick/httpservlet/filehandler.rb (WEBrick::HTTPServlet::FileHandler#get_servlet): new method to search servlet correspond to the suffix of filename. - + * lib/webrick/httprequest.rb: add attributes access methods: accept, accept_charset, accept_encoding, accept_language, content_length and content_type. - + * lib/webrick/httpresponse.rb: add attribute access methods: content_length, content_length=, content_type and content_type=. - + * lib/webrick/httputils.rb (WEBrick::HTTPUtils.mime_types): use the second suffix to detect media type. (the first suffix may be a language name.) - + * lib/webrick/httputils.rb (WEBrick::HTTPUtils.parse_qvalues): add method to parse Accept header field. it returns an Array of values sorted by the qvalues. @@ -70,7 +75,7 @@ Sat Oct 16 13:34:56 2004 Kouhei Sutou Fri Oct 15 18:04:35 2004 Hidetoshi NAGAI * ext/tk/lib/tk/timer.rb: TkTimer.new(interval, loop){ ... } is - acceptable. Add TkTimer.start ( == new + start ). + acceptable. Add TkTimer.start ( == new + start ). Fri Oct 15 12:43:09 2004 Tanaka Akira diff --git a/file.c b/file.c index ffa70c609..d656b705c 100644 --- a/file.c +++ b/file.c @@ -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); -- cgit