Subject: ftpd
To: None <port-hp300@sun-lamp.cs.berkeley.edu>
From: David Carrel <carrel@cisco.com>
List: port-hp300
Date: 06/02/1994 12:32:50
------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"

Hey, I have a running kernel off yesterday's sup.  Great Job all of you who
were responsible for keeping the hp300 port going strong!!!  Thanks.

One small patch though.  Ftpd is slightly broken.  I mailed a patch for
this to current-users but nobody seemed to care.  But I later realized why.
The problem will only show up for big endian machines.  Maybe some of the
big endian people on this list can check this into the main sources.

The problem is that ftpd always reports that it is transfering 0 byte
files.  This is an off_t problem with printf.  There are two ways to fix
this: Either use a explicit casts or get gcc to interpret printf format
strings.  A diff that does casting is below.

The problem looks like this:
	ftp> get .bashrc
	227 Entering Passive Mode (198,161,71,21,4,1)
	150 Opening BINARY mode data connection for .bashrc (0 bytes).
							    ^^^
The file transfers just fine and is definitely not 0 bytes.

Dave


------- =_aaaaaaaaaa0
Content-Type: text/plain; charset="us-ascii"
Content-Description: ftpd patch

diff -r -c /usr/src/libexec/ftpd/ftpcmd.y ./ftpcmd.y
*** /usr/src/libexec/ftpd/ftpcmd.y	Fri Apr 15 04:06:43 1994
--- ./ftpcmd.y	Tue May 10 23:21:31 1994
***************
*** 1171,1177 ****
  		    (stbuf.st_mode&S_IFMT) != S_IFREG)
  			reply(550, "%s: not a plain file.", filename);
  		else
! 			reply(213, "%lu", stbuf.st_size);
  		break;}
  	case TYPE_A: {
  		FILE *fin;
--- 1171,1177 ----
  		    (stbuf.st_mode&S_IFMT) != S_IFREG)
  			reply(550, "%s: not a plain file.", filename);
  		else
! 			reply(213, "%lu", (unsigned long)stbuf.st_size);
  		break;}
  	case TYPE_A: {
  		FILE *fin;
diff -r -c /usr/src/libexec/ftpd/ftpd.c ./ftpd.c
*** /usr/src/libexec/ftpd/ftpd.c	Fri Apr 15 04:06:44 1994
--- ./ftpd.c	Tue May 10 23:21:10 1994
***************
*** 719,725 ****
  	file_size = size;
  	byte_count = 0;
  	if (size != (off_t) -1)
! 		(void) sprintf (sizebuf, " (%ld bytes)", size);
  	else
  		(void) strcpy(sizebuf, "");
  	if (pdata >= 0) {
--- 719,725 ----
  	file_size = size;
  	byte_count = 0;
  	if (size != (off_t) -1)
! 		(void) sprintf (sizebuf, " (%ld bytes)", (unsigned long)size);
  	else
  		(void) strcpy(sizebuf, "");
  	if (pdata >= 0) {

------- =_aaaaaaaaaa0--

------------------------------------------------------------------------------