File rlogin-handle-EIO-better.patch of Package rsh
From: Jiri Slaby <jslaby@suse.cz>
Subject: rlogin: handle EIO better
References: bnc#816514
EIO can be returned by the TTY layer for the moment when login closed
all its TTYs to perform hangup. Let's just ignore that error.
---
rlogind/rlogind.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- a/rlogind/rlogind.c
+++ b/rlogind/rlogind.c
@@ -67,6 +67,7 @@ char rcsid[] =
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include "pathnames.h"
#include "logwtmp.h"
@@ -246,7 +247,15 @@ static void protocol(int f, int p) {
pbp = pibuf;
if (pcc < 0 && errno == EWOULDBLOCK)
pcc = 0;
- else if (pcc <= 0)
+ else if (pcc < 0 && errno == EIO) {
+ /*
+ * login hung up and closed its pty side for
+ * a while. Let's just ignore that.
+ */
+ pcc = 0;
+ nanosleep(&(const struct timespec){ 0, 50000000 },
+ NULL);
+ } else if (pcc <= 0)
break;
else if (pibuf[0] == 0) {
pbp++, pcc--;