Subject: lib/3043: rcmd(3) gives an error; poll: protocol failure in circuit setup
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@ba2.so-net.or.jp>
List: netbsd-bugs
Date: 12/18/1996 13:24:23
>Number:         3043
>Category:       lib
>Synopsis:       rcmd(3) gives an error; poll: protocol failure in circuit setup
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 17 20:35:01 1996
>Last-Modified:
>Originator:     enami tsugutomo
>Organization:
	an individual
>Release:        NetBSD-current as of 1996 Dec. 15
>Environment:
System: NetBSD pavlov.enami.ba2.so-net.or.jp 1.2B NetBSD 1.2B (PAVLOV) #125: Fri Dec 13 14:06:50 JST 1996 enami@pavlov.enami.ba2.so-net.or.jp:/b/netbsd/kernel/compile/PAVLOV i386


>Description:
	rcmd(3) gives an following error:
		poll: protocol failure in circuit setup
>How-To-Repeat:
	For example, do rsh.

		enami@pavlov% rsh localhost pwd
		poll: protocol failure in circuit setup
		enami@pavlov% 

>Fix:
	Previously, in rcmd(3), select was passed NULL pointer to struct
	timeval that means to wait forever.  But now, it was modified to use
	poll with 0 as timeout, which means never blocking.

	Here is a patch to wait forever like previous behaviour.

Index: rcmd.c
===================================================================
RCS file: /a/cvsroot/NetBSD/lib/libc/net/rcmd.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 rcmd.c
*** rcmd.c	1996/12/17 14:07:23	1.1.1.4
--- rcmd.c	1996/12/18 04:13:13
***************
*** 158,164 ****
  		reads[0].events = reads[1].events = reads[0].revents =
  						    reads[1].revents = POLLIN;
  		errno = 0;
! 		if (poll(reads, 2, 0) < 1 || (reads[1].revents & POLLIN) == 0) {
  			if (errno != 0)
  				(void)fprintf(stderr,
  				    "rcmd: poll (setting up stderr): %s\n",
--- 158,165 ----
  		reads[0].events = reads[1].events = reads[0].revents =
  						    reads[1].revents = POLLIN;
  		errno = 0;
! 		if (poll(reads, 2, INFTIM) < 1 ||
! 		    (reads[1].revents & POLLIN) == 0) {
  			if (errno != 0)
  				(void)fprintf(stderr,
  				    "rcmd: poll (setting up stderr): %s\n",
>Audit-Trail:
>Unformatted: