diff options
author | stas <stas@FreeBSD.org> | 2010-04-29 07:59:55 +0800 |
---|---|---|
committer | stas <stas@FreeBSD.org> | 2010-04-29 07:59:55 +0800 |
commit | d797933bcd5cc218d9bf560d32d36f9021c82781 (patch) | |
tree | e4863703a0b4e33237958c13b99a8c95bf0e04cb /lang/ruby18 | |
parent | ab08d8932dd73617c139c67c70289ea5a9fc50c0 (diff) | |
download | freebsd-ports-gnome-d797933bcd5cc218d9bf560d32d36f9021c82781.tar.gz freebsd-ports-gnome-d797933bcd5cc218d9bf560d32d36f9021c82781.tar.zst freebsd-ports-gnome-d797933bcd5cc218d9bf560d32d36f9021c82781.zip |
- Fix incorrect errno returned by IO::write.
Reported by: John-Paul Bader <contact@smyck.org>
Obtained from: ruby svn (revision r26253)
Diffstat (limited to 'lang/ruby18')
-rw-r--r-- | lang/ruby18/files/patch-fwrite-preserve-errno | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lang/ruby18/files/patch-fwrite-preserve-errno b/lang/ruby18/files/patch-fwrite-preserve-errno new file mode 100644 index 000000000000..663655ae4562 --- /dev/null +++ b/lang/ruby18/files/patch-fwrite-preserve-errno @@ -0,0 +1,23 @@ +Index: io.c +=================================================================== +--- io.c (revision 26252) ++++ io.c (revision 26253) +@@ -122,6 +122,9 @@ + # endif + #endif + ++#define preserving_errno(stmts) \ ++ do {int saved_errno = errno; stmts; errno = saved_errno;} while (0) ++ + VALUE rb_cIO; + VALUE rb_eEOFError; + VALUE rb_eIOError; +@@ -490,7 +493,7 @@ + r = write(fileno(f), RSTRING(str)->ptr+offset, l); + TRAP_END; + #if BSD_STDIO +- fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET); ++ preserving_errno(fseeko(f, lseek(fileno(f), (off_t)0, SEEK_CUR), SEEK_SET)); + #endif + if (r == n) return len; + if (0 <= r) { |