Skip to content

Commit

Permalink
* io.c (rb_io_oflags_modestr): return "r" for O_RDONLY|O_APPEND.
Browse files Browse the repository at this point in the history
  [ruby-dev:40379]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26644 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed Feb 11, 2010
1 parent e95a439 commit c09bcd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Thu Feb 11 20:43:00 2010 Tanaka Akira <[email protected]>

* io.c (rb_io_oflags_modestr): return "r" for O_RDONLY|O_APPEND.
[ruby-dev:40379]

Thu Feb 11 19:19:21 2010 Kazuhiro NISHIYAMA <[email protected]>

* missing/alloca.c: s/RUBY_LIB/RUBY_LIB_PREFIX/ [ruby-dev:40395]
Expand Down
7 changes: 5 additions & 2 deletions io.c
Original file line number Diff line number Diff line change
Expand Up @@ -4111,11 +4111,14 @@ rb_io_oflags_modestr(int oflags)
#else
# define MODE_BINARY(a,b) (a)
#endif
int accmode = oflags & (O_RDONLY|O_WRONLY|O_RDWR);
if (oflags & O_APPEND) {
if ((oflags & O_RDWR) == O_RDWR) {
if (accmode == O_WRONLY) {
return MODE_BINARY("a", "ab");
}
if (accmode == O_RDWR) {
return MODE_BINARY("a+", "ab+");
}
return MODE_BINARY("a", "ab");
}
switch (oflags & (O_RDONLY|O_WRONLY|O_RDWR)) {
case O_RDONLY:
Expand Down

0 comments on commit c09bcd3

Please sign in to comment.