ruby-changes:51370
From: normal <ko1@a...>
Date: Wed, 6 Jun 2018 05:47:01 +0900 (JST)
Subject: [ruby-changes:51370] normal:r63576 (trunk): io.c: fix compilation when IOV_MAX is not defined
normal 2018-06-06 05:46:56 +0900 (Wed, 06 Jun 2018) New Revision: 63576 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63576 Log: io.c: fix compilation when IOV_MAX is not defined GNU/Hurd has writev(2) but does not define IOV_MAX [ruby-core:87417] [Bug #14827] Reported-by: Paul Sonnenschein Modified files: trunk/io.c Index: io.c =================================================================== --- io.c (revision 63575) +++ io.c (revision 63576) @@ -1626,6 +1626,16 @@ io_fwritev(int argc, VALUE *argv, rb_io_ https://github.com/ruby/ruby/blob/trunk/io.c#L1626 return n; } + +static int +iovcnt_ok(int iovcnt) +{ +#ifdef IOV_MAX + return iovcnt < IOV_MAX; +#else /* GNU/Hurd has writev, but no IOV_MAX */ + return 1; +#endif +} #endif /* HAVE_WRITEV */ static VALUE @@ -1649,7 +1659,7 @@ io_writev(int argc, VALUE *argv, VALUE i https://github.com/ruby/ruby/blob/trunk/io.c#L1659 for (i = 0; i < argc; i += cnt) { #ifdef HAVE_WRITEV - if ((fptr->mode & (FMODE_SYNC|FMODE_TTY)) && ((cnt = argc - i) < IOV_MAX)) { + if ((fptr->mode & (FMODE_SYNC|FMODE_TTY)) && iovcnt_ok(cnt = argc - i)) { n = io_fwritev(cnt, &argv[i], fptr); } else -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/