Subject: bin/3040: ftp doesn't preserve file modtime if it's size is 0
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@ba2.so-net.or.jp>
List: netbsd-bugs
Date: 12/17/1996 23:32:21
>Number:         3040
>Category:       bin
>Synopsis:       ftp doesn't preserve file modtime if it's size is 0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 17 06:50:00 1996
>Last-Modified:
>Originator:     enami tsugutomo
>Organization:
	an individual
>Release:        NetBSD-current as of 1996 Dec. 13
>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:
	ftp doesn't preserve file modtime if it's size is 0.
>How-To-Repeat:
	try to get file whose size is 0.
>Fix:
	here is my fix:
cvs diff: Diffing .
Index: ftp.c
===================================================================
RCS file: /a/cvsroot/NetBSD/usr.bin/ftp/ftp.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 ftp.c
*** ftp.c	1996/12/07 03:34:55	1.1.1.4
--- ftp.c	1996/12/17 14:27:37
***************
*** 1055,1062 ****
  		(void) signal(SIGPIPE, oldintp);
  	(void) fclose(din);
  	(void) getreply(0);
! 	if (bytes > 0 && is_retr) {
! 		ptransfer(0);
  		if (preserve && (closefunc == fclose)) {
  			mtime = remotemodtime(remote);
  			if (mtime != -1) {
--- 1055,1063 ----
  		(void) signal(SIGPIPE, oldintp);
  	(void) fclose(din);
  	(void) getreply(0);
! 	if (bytes >= 0 && is_retr) {
! 		if (bytes > 0)
! 			ptransfer(0);
  		if (preserve && (closefunc == fclose)) {
  			mtime = remotemodtime(remote);
  			if (mtime != -1) {
>Audit-Trail:
>Unformatted: