summaryrefslogtreecommitdiff
path: root/ext/pty/pty.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-22 00:47:50 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-22 00:47:50 +0000
commit900b62a2e96228d75c3552e04e81fd12f474a1d3 (patch)
tree11c98bbe39879cbb1c083354eab72003ba9877a6 /ext/pty/pty.c
parentf1cbd700e8107f6871dfc18814f3a19b8beb225f (diff)
Supress warnings: unused variables
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/pty/pty.c')
-rw-r--r--ext/pty/pty.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index e20c02b..7ea2e1a 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;