aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstas <stas@FreeBSD.org>2010-04-29 07:59:55 +0800
committerstas <stas@FreeBSD.org>2010-04-29 07:59:55 +0800
commitd797933bcd5cc218d9bf560d32d36f9021c82781 (patch)
treee4863703a0b4e33237958c13b99a8c95bf0e04cb
parentab08d8932dd73617c139c67c70289ea5a9fc50c0 (diff)
downloadfreebsd-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)
-rw-r--r--Mk/bsd.ruby.mk2
-rw-r--r--lang/ruby18/files/patch-fwrite-preserve-errno23
2 files changed, 24 insertions, 1 deletions
diff --git a/Mk/bsd.ruby.mk b/Mk/bsd.ruby.mk
index 3e0084dbafee..acb99430a9ef 100644
--- a/Mk/bsd.ruby.mk
+++ b/Mk/bsd.ruby.mk
@@ -170,7 +170,7 @@ RUBY?= ${LOCALBASE}/bin/${RUBY_NAME}
# Ruby 1.8
#
RUBY_RELVERSION= 1.8.7
-RUBY_PORTREVISION= 1
+RUBY_PORTREVISION= 2
RUBY_PORTEPOCH= 1
RUBY_PATCHLEVEL= 248
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) {