From 1a758829403751e7d96c7aff28c9683ad7c08085 Mon Sep 17 00:00:00 2001 From: ginsbach Date: Fri, 17 Mar 2006 21:52:41 +0000 Subject: [PATCH] Fix Coverity issue 1236, negative return from read() passed to write() as a large unsigned valued when read() is interrupted (errno == EINTR). --- usr.bin/rsh/rsh.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c index db17952903a8..bdcd671e973a 100644 --- a/usr.bin/rsh/rsh.c +++ b/usr.bin/rsh/rsh.c @@ -1,4 +1,4 @@ -/* $NetBSD: rsh.c,v 1.27 2005/03/11 03:20:23 ginsbach Exp $ */ +/* $NetBSD: rsh.c,v 1.28 2006/03/17 21:52:41 ginsbach Exp $ */ /*- * Copyright (c) 1983, 1990, 1993, 1994 @@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1990, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)rsh.c 8.4 (Berkeley) 4/29/95"; #else -__RCSID("$NetBSD: rsh.c,v 1.27 2005/03/11 03:20:23 ginsbach Exp $"); +__RCSID("$NetBSD: rsh.c,v 1.28 2006/03/17 21:52:41 ginsbach Exp $"); #endif #endif /* not lint */ @@ -471,8 +471,10 @@ talk(int nflag, sigset_t *oset, __pid_t pid, int rem) if (nr == -1) { if (errno == EIO) goto done; - if (errno == EINTR) + if (errno == EINTR) { + nr = 0; continue; + } err(1, "read"); } bp = buf;