svn commit: r225803 - stable/9/usr.bin/fetch

Dag-Erling Smorgrav des at FreeBSD.org
Tue Sep 27 17:04:13 UTC 2011


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 */


More information about the svn-src-stable-other mailing list