Path: utzoo!attcan!uunet!mcvax!sjoerd From: sjoerd@cwi.nl (Sjoerd Mullender) Newsgroups: comp.bugs.4bsd Subject: rshd leaves too many files open Message-ID: <7837@boring.cwi.nl> Date: 18 Jan 89 15:29:51 GMT Sender: news@cwi.nl Organization: CWI, Amsterdam Lines: 27 Reply-To: Index: etc/rshd.c 4.3BSD-tahoe Fix Description: When you rsh to a remote machine, rsh leaves open a file descriptor other than 0, 1, and 2. Repeat-By: Write a program that lists its open files and execute it using rsh. Notice that there are 4 open files: 0, 1, 2, and one extra. Fix: Add an extra close statement, as in the attached context diff. *** /tmp/d16692 Mon Jan 16 14:50:45 1989 --- rshd.c Mon Jan 16 14:25:58 1989 *************** *** 263,268 **** --- 263,269 ---- setpgrp(0, getpid()); (void) close(s); (void) close(pv[0]); dup2(pv[1], 2); + (void) close(pv[1]); } if (*pwd->pw_shell == '\0') pwd->pw_shell = "/bin/sh"; -- Sjoerd Mullender e-mail: sjoerd@cwi.nl Centre for Mathematics and Computer Science, Amsterdam