From 900b62a2e96228d75c3552e04e81fd12f474a1d3 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 22 Oct 2012 00:47:50 +0000 Subject: [PATCH] Supress warnings: unused variables git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/pty/pty.c | 15 ++++++++------- ext/socket/ancdata.c | 4 ++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ext/pty/pty.c b/ext/pty/pty.c index e20c02bfac..7ea2e1aaf5 100644 --- a/ext/pty/pty.c +++ b/ext/pty/pty.c @@ -223,7 +223,6 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, int masterfd = -1, slavefd = -1; char *slavedevice; struct sigaction dfl, old; - int flags; dfl.sa_handler = SIG_DFL; dfl.sa_flags = 0; @@ -238,14 +237,16 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg, if (grantpt(masterfd) == -1) goto grantpt_error; rb_fd_fix_cloexec(masterfd); #else - flags = O_RDWR|O_NOCTTY; + { + int flags = O_RDWR|O_NOCTTY; # if defined(O_CLOEXEC) - /* glibc posix_openpt() in GNU/Linux calls open("/dev/ptmx", flags) internally. - * So version dependency on GNU/Linux is same as O_CLOEXEC with open(). - * O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */ - flags |= O_CLOEXEC; + /* glibc posix_openpt() in GNU/Linux calls open("/dev/ptmx", flags) internally. + * So version dependency on GNU/Linux is same as O_CLOEXEC with open(). + * O_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */ + flags |= O_CLOEXEC; # endif - if ((masterfd = posix_openpt(flags)) == -1) goto error; + if ((masterfd = posix_openpt(flags)) == -1) goto error; + } rb_fd_fix_cloexec(masterfd); if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error; if (grantpt(masterfd) == -1) goto grantpt_error; diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index 4ba339a83d..050da974c4 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -1163,8 +1163,10 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) #if defined(HAVE_ST_MSG_CONTROL) int i; size_t last_pad = 0; +#if defined(__NetBSD__) int last_level = 0; int last_type = 0; +#endif controls_str = rb_str_tmp_new(0); for (i = 0; i < controls_num; i++) { VALUE elt = controls_ptr[i], v; @@ -1203,8 +1205,10 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock) cmh.cmsg_len = (socklen_t)CMSG_LEN(RSTRING_LEN(cdata)); MEMCPY(cmsg, &cmh, char, sizeof(cmh)); MEMCPY(cmsg+((char*)CMSG_DATA(&cmh)-(char*)&cmh), RSTRING_PTR(cdata), char, RSTRING_LEN(cdata)); +#if defined(__NetBSD__) last_level = cmh.cmsg_level; last_type = cmh.cmsg_type; +#endif last_pad = cspace - cmh.cmsg_len; } if (last_pad) {