summaryrefslogtreecommitdiff
path: root/ext/io/console/console.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-01 22:08:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-01 22:08:41 +0000
commit0e24a11b597840f4690ac9738fbc3a2f7fa61b8a (patch)
tree38cedf7d35783f59bbf9fae09d8e42c04da0f07d /ext/io/console/console.c
parentec8f4038c92004ba684851ac6196c39207fbb316 (diff)
* ext/io/console/console.c (setattr): should retry on EINTR.
[ruby-dev:42666] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/io/console/console.c')
-rw-r--r--ext/io/console/console.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c
index af8a1de694d..11bb40435a4 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -26,7 +26,15 @@ typedef OpenFile rb_io_t;
#if defined HAVE_TERMIOS_H
# include <termios.h>
typedef struct termios conmode;
-# define setattr(fd, t) (tcsetattr(fd, TCSAFLUSH, t) == 0)
+
+static int
+setattr(int fd, conmode *t)
+{
+ while (tcsetattr(fd, TCSAFLUSH, t)) {
+ if (errno != EINTR) return 0;
+ }
+ return 1;
+}
# define getattr(fd, t) (tcgetattr(fd, t) == 0)
#elif defined HAVE_TERMIO_H
# include <termio.h>