ruby-changes:17986
From: nobu <ko1@a...>
Date: Thu, 2 Dec 2010 07:17:37 +0900 (JST)
Subject: [ruby-changes:17986] Ruby:r30007 (trunk): * ext/io/console/console.c (setattr): should retry on EINTR.
nobu 2010-12-02 07:08:41 +0900 (Thu, 02 Dec 2010) New Revision: 30007 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30007 Log: * ext/io/console/console.c (setattr): should retry on EINTR. [ruby-dev:42666] Modified files: trunk/ChangeLog trunk/ext/io/console/console.c Index: ChangeLog =================================================================== --- ChangeLog (revision 30006) +++ ChangeLog (revision 30007) @@ -1,3 +1,8 @@ +Thu Dec 2 07:08:38 2010 Nobuyoshi Nakada <nobu@r...> + + * ext/io/console/console.c (setattr): should retry on EINTR. + [ruby-dev:42666] + Thu Dec 2 02:30:50 2010 Eric Hodel <drbrain@s...> * lib/net/http.rb: fixed positional wording to match revised order. Index: ext/io/console/console.c =================================================================== --- ext/io/console/console.c (revision 30006) +++ ext/io/console/console.c (revision 30007) @@ -26,7 +26,15 @@ #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> -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/