Skip site navigation (1)Skip section navigation (2)
Date:      30 Nov 2000 09:59:19 +0100
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        asami@freebsd.org (Satoshi Asami)
Cc:        stable@freebsd.org
Subject:   Re: fetch: transfer timed out
Message-ID:  <xzp1yvtygwo.fsf@flood.ping.uio.no>
In-Reply-To: asami@freebsd.org's message of "Wed, 29 Nov 2000 07:48:30 -0800 (PST)"
References:  <200011291548.eATFmUN83621@silvia.hip.berkeley.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=

asami@freebsd.org (Satoshi Asami) writes:
> I've noticed a few of these recently.  This suggests that fetch is
> exiting with zero even though the transfer timed out.

Try the attached patch.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=timeout.diff
Content-Description: timeout patch

Index: fetch.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/fetch/fetch.c,v
retrieving revision 1.10.2.7
diff -u -r1.10.2.7 fetch.c
--- fetch.c	2000/09/17 19:51:14	1.10.2.7
+++ fetch.c	2000/11/30 08:48:27
@@ -384,7 +384,7 @@
 
     stat_end(&xs);
 
-    /* Set mtime of local file */
+    /* set mtime of local file */
     if (!n_flag && us.mtime && !o_stdout
 	&& (stat(path, &sb) != -1) && sb.st_mode & S_IFREG) {
 	struct timeval tv[2];
@@ -420,6 +420,15 @@
     if (us.size != -1 && count < us.size) {
 	warnx("%s appears to be truncated: %lld/%lld bytes",
 	      path, count, us.size);
+	goto failure_keep;
+    }
+    
+    /*
+     * If the transfer timed out and we didn't know how much to
+     * expect, assume the worst (i.e. we didn't get all of it)
+     */
+    if (sigalrm && us.size == -1) {
+	warnx("%s may be truncated", path);
 	goto failure_keep;
     }
     

--=-=-=--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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