Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Sep 2011 17:04:13 +0000 (UTC)
From:      Dag-Erling Smorgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-other@freebsd.org
Subject:   svn commit: r225803 - stable/9/usr.bin/fetch
Message-ID:  <201109271704.p8RH4D5c032668@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Tue Sep 27 17:04:13 2011
New Revision: 225803
URL: http://svn.freebsd.org/changeset/base/225803

Log:
  MFH r225800: finally fix resume mode with non-cooperating server.
  
  Approved by:	re (kib)

Modified:
  stable/9/usr.bin/fetch/fetch.c
Directory Properties:
  stable/9/usr.bin/fetch/   (props changed)

Modified: stable/9/usr.bin/fetch/fetch.c
==============================================================================
--- stable/9/usr.bin/fetch/fetch.c	Tue Sep 27 16:57:14 2011	(r225802)
+++ stable/9/usr.bin/fetch/fetch.c	Tue Sep 27 17:04:13 2011	(r225803)
@@ -540,7 +540,7 @@ fetch(char *URL, const char *path)
 				goto failure;
 			}
 			/* we got it, open local file */
-			if ((of = fopen(path, "a")) == NULL) {
+			if ((of = fopen(path, "r+")) == NULL) {
 				warn("%s: fopen()", path);
 				goto failure;
 			}
@@ -559,13 +559,13 @@ fetch(char *URL, const char *path)
 				sb = nsb;
 				/* picked up again later */
 			}
-			/* seek to where we left off */
-			if (of != NULL && fseek(of, url->offset, SEEK_SET) != 0) {
-				warn("%s: fseek()", path);
-				fclose(of);
-				of = NULL;
-				/* picked up again later */
-			}
+		}
+		/* seek to where we left off */
+		if (of != NULL && fseek(of, url->offset, SEEK_SET) != 0) {
+			warn("%s: fseek()", path);
+			fclose(of);
+			of = NULL;
+			/* picked up again later */
 		}
 	} else if (m_flag && sb.st_size != -1) {
 		/* mirror mode, local file exists */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109271704.p8RH4D5c032668>