Commit graph

406 commits

Author SHA1 Message Date
shyouhei
793f30e38f * eval.c (rb_thread_atfork): When a ruby process forks, its random
seed shall be reinitialized to prevent CVE-2003-0900 situation.
  This bug affects for 1.8 and earlier series, but not for 1.9.
  fixed [ruby-core:34944].

* io.c (pipe_open): ditto.

* random.c (rb_reset_random_seed): ditto.

* intern.h (rb_reset_random_seed): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@31655 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-20 21:21:39 +00:00
matz
ebee527699 * io.c (rb_f_syscall): should check argument string taint before
invoking system calls.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@28294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-12 01:04:31 +00:00
kosaki
968bac58e6 * io.c, eval.c, process.c: remove all condition of r26371.
now, all platform use the same way. [Bug #3278][ruby-core:30167]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@27983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-23 20:00:48 +00:00
nobu
c89882197e * io.c (appendline): should terminate.
http://golf.shinh.org/p.rb?DECimal+number+to+BINary#Ruby


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@27339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-14 08:53:49 +00:00
naruse
c50494d6bb * io.c, eval.c, process.c: add linux to r26371's condition.
patched by Motohiro KOSAKI [ruby-core:28151]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-18 04:52:27 +00:00
akr
a3742530e8 * io.c (rb_io_modenum_mode): return "r" for O_RDONLY|O_APPEND.
[ruby-dev:40379]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-11 11:45:56 +00:00
naruse
f0caeb92e8 * io.c, eval.c, process.c: add __APPLE__ to r26371's condition.
patched by Wataru Kimura [ruby-dev:40145]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-27 05:11:17 +00:00
usa
031cab4d2f * eval.c (thread_timer, rb_thread_stop_timer): check the timing of
stopping timer.  patch from KOSAKI Motohiro <kosaki.motohiro _AT_
  jp.fujitsu.com>

* eval.c (rb_thread_start_timer): NetBSD5 seems to be hung when calling
  pthread_create() from pthread_atfork()'s parent handler.

* io.c (pipe_open): workaround for NetBSD5. stop timer thread before
  fork(), and start it if needed.

* process.c (rb_f_fork, rb_f_system): ditto.
  fixed [ruby-dev:40074]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-21 16:29:51 +00:00
nobu
c1d3b01b7a * io.c (io_fwrite): preserve errno. [ruby-core:27425]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-08 09:51:23 +00:00
usa
ddc1791462 * io.c (rb_io_s_read): close the IO if an exception is raised on
seeking. [ruby-core:27429]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-08 08:08:21 +00:00
nobu
ce4e9dff9b * io.c (io_fwrite): adjust stdio file position after direct write on
BSDish platforms.   [ruby-core:26300]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-26 03:06:29 +00:00
nobu
3f0d0b9398 * *.[chy]: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25430 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-22 01:00:18 +00:00
matz
4b986d7ff4 * io.c (rb_io_fptr_finalize): free fptr to avoid memory leaks.
fixed: #2009   [ruby-core:25173] [ruby-dev:39410]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@25181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-02 08:25:29 +00:00
nobu
d24f4c0fe3 * io.c (rb_io_binmode): check if closed regardless platforms.
[ruby-core:25363]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-04 21:29:29 +00:00
usa
896285b4ea * io.c (rb_sysopen): workaround for MSVCRT's bug.
[ruby-core:24838]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-11 05:00:23 +00:00
nobu
27a9a7d1db * io.c (argf_eof): go to the next file if called after ARGF.close
or ARGF.skip.  [ruby-core:24561]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24284 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-26 10:17:39 +00:00
nobu
b259db28fd * io.c (Init_IO): $FILENAME should correspond to the first element
of ARGV initially.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-26 09:42:28 +00:00
usa
72121b1681 * io.c (rb_io_flush): fsync() after buffer is flushed on win32.
backported from trunk.  [ruby-core:20043]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24223 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-21 10:40:47 +00:00
akr
c8eabecb9d rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 16:31:49 +00:00
nobu
47fc6a3ad0 * io.c (rb_io_open), math.c (domain_check), object.c (boot_defclass):
constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 13:23:04 +00:00
matz
14d860d9ce * io.c (argf_close): always call #close method. [ruby-core:23853]
* io.c (argf_skip): should close only when current_file is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-16 01:15:19 +00:00
knu
e8b0f17319 * array.c (ary_resize_capa): Remove an unused function.
* array.c, bignum.c, dir.c, enumerator.c, gc.c, io.c, numeric.c,
  object.c, re.c, string.c, struct.c: Mixing two styles is not a
  good thing.  Stick with the K&R style in 1.8.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-23 12:07:23 +00:00
knu
f1f12658ee * array.c (Array#try_convert): New method backported from 1.9.
* hash.c (Hash#try_convert): New method backported from 1.9.

* io.c (IO#try_convert): New method backported from 1.9.

* re.c (Regexp#try_convert): New method backported from 1.9.

* string.c (String#try_convert): New method backported from 1.9.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@23018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-20 09:43:24 +00:00
akr
1babcafb03 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-07 14:50:58 +00:00
akr
dc20aac2ce add not about IO#pos and IO#readpartial.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@22110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-07 12:04:31 +00:00
akr
ad98dd2c24 * io.c (io_getpartial): fflush after read for updating pos in FILE.
not portable, I guess.  [ruby-core:21561]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-31 07:07:21 +00:00
akr
127d914b2e rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-25 16:15:00 +00:00
matz
98183a08c7 * dln.c: newer BeOS support. a patch from Pete Goodeve
<pete.goodeve at computer.org> in [ruby-core:18712].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@19424 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-19 00:32:22 +00:00
nobu
d4c32f93e2 * file.c (rb_find_file): reset to real class.
* io.c (io_reopen): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@18378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-05 20:10:16 +00:00
usa
c63b718fea * io.c (rb_open_file, rb_io_s_sysopen): fmode should be unsigned int.
fixed [ruby-dev:34979]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-06 16:50:50 +00:00
nobu
4940cff399 * io.c (rscheck), marshal.c (w_nbyte, w_bytes, w_unique),
(path2class, path2module): constified.

* pack.c (pack_unpack), process.c (rb_syswait): suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 20:28:01 +00:00
nobu
9ed3d64d1d * suppress warnings on cygwin, mingw and mswin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 19:55:25 +00:00
nobu
1378795e08 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
knu
e37b7b77a8 * ext/stringio/stringio.c (strio_each): Return an enumerator if no
block is given.
  (strio_each_byte): Return an enumerator if no block is given,
  and return self if one is given as the rdoc says.

* io.c (rb_io_each_byte): Fix rdoc.  IO#each_byte returns self,
  not nil.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 09:16:11 +00:00
knu
1906045a8f * io.c (rb_io_each_char, argf_each_char, Init_IO):
Add {IO#,ARGF.}{each_char,chars}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 06:39:47 +00:00
knu
30fe2b177c * io.c (Init_IO): Define {IO,ARGF}#{getbyte,readbyte}.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:44:12 +00:00
knu
6b7869ae42 * io.c: (rb_io_lines, rb_io_bytes, Init_IO): Define
IO#{lines,bytes} and ARGF.{lines,bytes}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-27 04:22:56 +00:00
nobu
722ad8f214 * eval.c (search_method, remove_method, error_print, rb_alias)
(rb_eval, rb_rescue2, search_required, Init_eval, rb_thread_create),
  gc.c (rb_source_filename, Init_stack), io.c (rb_io_getline),
  parse.y (rb_id2name, rb_parser_free): suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-21 14:29:55 +00:00
nobu
9cee075559 * rubyio.h (rb_io_t): renamed from OpenFile.
* ruby.h (struct RHash), file.c, gc.c, io.c, ext/dl/dl.c,
  ext/io/wait/wait.c, ext/pty/pty.c, ext/readline/readline.c,
  ext/socket/socket.c: ditto.

* win32/win32.h: removed workaround for OpenFile.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-15 03:35:55 +00:00
knu
f5f1a18ceb * enum.c (enum_find, enum_reject): Return an enumerator if no
block is given.

* io.c (rb_io_each_line, rb_io_each_byte, rb_io_s_foreach,
  argf_each_line, argf_each_byte): Ditto.

* string.c (str_gsub): Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-14 09:19:52 +00:00
matz
5074a2003f * io.c (rb_open_file): should check NUL in path.
<http://www.rubyist.net/~matz/20080125.html#c01>.

* io.c (rb_io_s_popen): ditto.

* io.c (rb_io_reopen): ditto.

* io.c (next_argv): ditto.

* io.c (rb_io_s_foreach): ditto.

* io.c (rb_io_s_readlines): ditto.

* io.c (rb_io_s_read): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-28 03:33:05 +00:00
knu
a7b5cb96c6 * io.c (rb_io_mode_flags, rb_io_mode_modenum): Ignore encoding
options for forward compatibility.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-21 08:43:58 +00:00
nobu
bf89a51315 * io.c (fptr_finalize): clear errno first. [ruby-talk:284492]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@14858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-03 02:29:04 +00:00
nobu
42cff90a29 * io.c (rb_io_tell, rb_io_seek): check errno too. [ruby-dev:32093]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-25 05:19:33 +00:00
nobu
233a94b91e * error.c (rb_notimplement), io.c (pipe_open): removed definite
articles and UNIX manual section from messages.  [ruby-dev:30690]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-04 15:42:16 +00:00
nobu
f67fc8a43f * io.c (pipe_open): refined the message of NotImplementedError.
[ruby-dev:30685]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-04 08:08:46 +00:00
nobu
496371638e * io.c (pipe_open): raise NotImplementedError for command "-" on
platforms where fork(2) is not available.  [ruby-dev:30681]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-04-04 01:17:34 +00:00
nobu
d33cc535c3 * node.h (struct rb_thread.locals): explicit as struct.
[ruby-core:10585]

* eval.c, node.h (enum rb_thread_status, struct rb_thread,
  rb_curr_thread, rb_main_thread): prefixed.  [ruby-core:10586]

* file.c (chompdirsep): made an unprefixed name static.

* io.c (io_fread): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-24 14:40:08 +00:00
knu
438c4a6fdc * io.c (rb_f_syscall): Fix buffer overflow with syscall
arguments.  [ruby-bugs:PR#8541]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-13 06:21:47 +00:00
matz
43786b302e * io.c (ruby_dup): start GC on ENOMEM as well.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@11455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-03 03:37:56 +00:00