diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-16 06:54:40 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-04-16 06:54:40 +0000 |
commit | ac34c44470406442e9912611858de77b43800a8b (patch) | |
tree | 058d1ce66cde9c9141389b312db815c8f748d8b3 /io.c | |
parent | 4c61680885299984b5b1a51845766c4f6ca39c3b (diff) |
* regex.c (calculate_must_string): wrong length calculation.
* eval.c (rb_thread_start_0): fixed memory leak.
* parse.y (none): should clear cmdarg_stack too.
* io.c (rb_fopen): use setvbuf() to avoid recursive malloc() on
some platforms.
* file.c (rb_stat_dev): device functions should honor stat field
types (except long long such as dev_t).
* eval.c (rb_mod_nesting): should not push nil for nesting array.
* eval.c (rb_mod_s_constants): should not search array by
rb_mod_const_at() for nil (happens for singleton class).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -27,6 +27,10 @@ # define NO_LONG_FNAME #endif +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(sun) +# define USE_SETVBUF +#endif + #include <sys/types.h> #if !defined(DJGPP) && !defined(NT) && !defined(__human68k__) #include <sys/ioctl.h> @@ -1362,6 +1366,9 @@ rb_fopen(fname, mode) rb_sys_fail(fname); } } +#ifdef USE_SETVBUF + setvbuf(file, NULL, _IOFBF, 0); +#endif #ifdef __human68k__ fmode(file, _IOTEXT); #endif @@ -1385,6 +1392,10 @@ rb_fdopen(fd, mode) rb_sys_fail(0); } } +#ifdef USE_SETVBUF + setvbuf(file, NULL, _IOFBF, 0); +#endif + return file; } @@ -1902,12 +1913,14 @@ rb_io_reopen(argc, argv, file) fclose(fptr->f2); fptr->f2 = 0; } + return file; } if (freopen(RSTRING(fname)->ptr, mode, fptr->f) == 0) { rb_sys_fail(fptr->path); } + if (fptr->f2) { if (freopen(RSTRING(fname)->ptr, "w", fptr->f2) == 0) { rb_sys_fail(fptr->path); |