*BSD News Article 9039


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel.anu.edu.au!munnari.oz.au!hp9000.csc.cuhk.hk!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!uw-beaver!newsfeed.rice.edu!rice!news.Rice.edu!rich
From: rich@Rice.edu (& Murphey)
Subject: Re: [386bsd] ftpd bugfix
In-Reply-To: gtoal@robobar.co.uk's message of Thu, 17 Dec 1992 21:15:39 +0000
Message-ID: <RICH.92Dec17231903@superego.Rice.edu>
Sender: news@rice.edu (News)
Reply-To: Rich@rice.edu
Organization: Department of Electrical and Computer Engineering, Rice
	University
References: <9212172115.aa05898@broccoli.robobar.co.uk>
Date: Fri, 18 Dec 1992 05:19:03 GMT
Lines: 45

>>>>> In article <9212172115.aa05898@broccoli.robobar.co.uk>, gtoal@robobar.co.uk (Graham Toal) writes:

Graham> Thanks to pauls@umich, we now know the reason for occassional problems
Graham> with the new ftp server that allows you to fetch whole directories as
Graham> .tar files.  What happens is that if the tar finds an unreadable file,
Graham> it skips it and outputs an error message to the 'screen' - unfortunately
Graham> because of the way the job is piped into ftp this ends up in the tar
Graham> file which then fails to unpack properly.

Graham> The interim solution is to make sure all your files are permitted!
Graham> The long-term solution is to fix the ftpd code so that error messages
Graham> are directed somewhere else, and if possible reported to the ftp client.

Graham> Graham

Thanks very much for tracking this down!

The following patch fixes the bug Graham describes.  We still need to
add error reporting, but this will help meanwhile.  Any comments on
that are welcome!

I'll update the sources and binaries on ref.tfs.com (140.145.254.251)
in /usr/packages/ftpd-*.tar.Z and post another followup. Rich


diff -c -r1.1 popen.c
*** /tmp/,RCSt1012643	Thu Dec 17 23:05:46 1992
--- popen.c	Thu Dec 17 23:05:02 1992
***************
*** 108,114 ****
  		if (*type == 'r') {
  			if (pdes[1] != 1) {
  				dup2(pdes[1], 1);
! 				dup2(pdes[1], 2);	/* stderr, too! */
  				(void)close(pdes[1]);
  			}
  			(void)close(pdes[0]);
--- 108,114 ----
  		if (*type == 'r') {
  			if (pdes[1] != 1) {
  				dup2(pdes[1], 1);
! 				/* dup2(pdes[1], 2);	/* stderr, too! */
  				(void)close(pdes[1]);
  			}
  			(void)close(pdes[0]);