Module Name:    src
Committed By:   mlelstv
Date:           Sat Aug 12 07:40:13 UTC 2023

Modified Files:
        src/usr.bin/ftp: fetch.c

Log Message:
Don't finish downloading an empty file with 'already done' before it is
created locally.


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/usr.bin/ftp/fetch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/ftp/fetch.c
diff -u src/usr.bin/ftp/fetch.c:1.237 src/usr.bin/ftp/fetch.c:1.238
--- src/usr.bin/ftp/fetch.c:1.237	Sun Jul  2 10:02:09 2023
+++ src/usr.bin/ftp/fetch.c	Sat Aug 12 07:40:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fetch.c,v 1.237 2023/07/02 10:02:09 mlelstv Exp $	*/
+/*	$NetBSD: fetch.c,v 1.238 2023/08/12 07:40:13 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1997-2015 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: fetch.c,v 1.237 2023/07/02 10:02:09 mlelstv Exp $");
+__RCSID("$NetBSD: fetch.c,v 1.238 2023/08/12 07:40:13 mlelstv Exp $");
 #endif /* not lint */
 
 /*
@@ -1652,9 +1652,10 @@ fetch_url(const char *url, const char *p
 		}
 	}
 	if (fout == NULL) {
-		if ((pi.rangeend != -1 && pi.rangeend <= restart_point) ||
+		if (restart_point && (
+		    (pi.rangeend != -1 && pi.rangeend <= restart_point) ||
 		    (pi.rangestart == -1 &&
-		    filesize != -1 && filesize <= restart_point)) {
+		    filesize != -1 && filesize <= restart_point))) {
 			/* already done */
 			if (verbose)
 				fprintf(ttyout, "already done\n");

Reply via email to