diff options
author | dillo <dillo> | 2001-12-10 16:05:26 +0000 |
---|---|---|
committer | dillo <dillo> | 2001-12-10 16:05:26 +0000 |
commit | 5c5d0ffdcb57d53d17469ebc20d696d97270a7eb (patch) | |
tree | 162b9b753a800d8884e1993bdec6066c7e970b1e /net/cftp | |
parent | b56aacd7803d16918941ba6058e25f03c57193d1 (diff) | |
download | pkgsrc-5c5d0ffdcb57d53d17469ebc20d696d97270a7eb.tar.gz |
add fix from cftp cvs (ftp.c, revision 1.58):
(ftp_cat): rewrite error detection/reporting: don't rely on
ferror(), only consult errno in case of error.
This fixes download problems on -current.
Bump version to 0.11nb1.
Diffstat (limited to 'net/cftp')
-rw-r--r-- | net/cftp/Makefile | 3 | ||||
-rw-r--r-- | net/cftp/distinfo | 3 | ||||
-rw-r--r-- | net/cftp/patches/patch-aa | 87 |
3 files changed, 91 insertions, 2 deletions
diff --git a/net/cftp/Makefile b/net/cftp/Makefile index 59cee380484..8193c7862ed 100644 --- a/net/cftp/Makefile +++ b/net/cftp/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.5 2001/09/11 23:07:57 dillo Exp $ +# $NetBSD: Makefile,v 1.6 2001/12/10 16:05:26 dillo Exp $ # DISTNAME= cftp-0.11 +PKGREVISION= 1 CATEGORIES= net MASTER_SITES= ftp://sunsite.csd.smc.univie.ac.at/pub/nih/cftp/ \ ftp://ftp.giga.or.at/pub/nih/cftp/ diff --git a/net/cftp/distinfo b/net/cftp/distinfo index 0e684535862..241e20ee441 100644 --- a/net/cftp/distinfo +++ b/net/cftp/distinfo @@ -1,4 +1,5 @@ -$NetBSD: distinfo,v 1.3 2001/09/11 23:07:57 dillo Exp $ +$NetBSD: distinfo,v 1.4 2001/12/10 16:05:26 dillo Exp $ SHA1 (cftp-0.11.tar.gz) = 5b76f43f8af3fc6bcbd744798c4f57c88087b1df Size (cftp-0.11.tar.gz) = 163869 bytes +SHA1 (patch-aa) = 67712743d700c036baa81676413c63c0eecb6291 diff --git a/net/cftp/patches/patch-aa b/net/cftp/patches/patch-aa new file mode 100644 index 00000000000..534f568e12c --- /dev/null +++ b/net/cftp/patches/patch-aa @@ -0,0 +1,87 @@ +$NetBSD: patch-aa,v 1.1 2001/12/10 16:05:27 dillo Exp $ + +--- ftp.c 2001/09/11 18:13:09 1.57 ++++ ftp.c 2001/10/05 13:13:49 1.58 +@@ -956,7 +956,8 @@ + ftp_cat(FILE *fin, FILE *fout, long start, long size, int upload) + { + char buf[4096], buf2[8192], *p; +- int nread, nwritten, err, trail_cr; ++ int nread, nwritten, err, trail_cr, errno_copy; ++ enum { ERR_NONE, ERR_FIN, ERR_FOUT } error_cause; + int old_alarm; + long got; + struct itimerval itv; +@@ -983,6 +984,7 @@ + ret=fcntl(fileno(fout), F_SETFL, flags); + } + ++ error_cause = ERR_NONE; + trail_cr = 0; + do_read = 1; + for (;;) { +@@ -993,7 +995,6 @@ + ret=select(fileno(fin)+1, &fds, NULL, NULL, NULL); + + if (ret != -1 && FD_ISSET(fileno(fin), &fds)) { +- errno = 0; + if ((nread=fread(buf, 1, 4096, fin)) > 0) { + do_read = 0; + nwritten = 0; +@@ -1009,8 +1010,13 @@ + &trail_cr); + } + } +- else if (errno != EAGAIN) ++ else { ++ if (nread < 0 && errno != EAGAIN) { ++ errno_copy = errno; ++ error_cause = ERR_FIN; ++ } + break; ++ } + } + } + else { +@@ -1018,10 +1024,12 @@ + ret=select(fileno(fin)+1, &fds, NULL, NULL, NULL); + + if (ret != -1 && FD_ISSET(fileno(fin), &fds)) { +- errno = 0; + if ((err=fwrite(p+nwritten, 1, nread-nwritten, +- fout)) < 0 && errno != EAGAIN) ++ fout)) < 0 && errno != EAGAIN) { ++ errno_copy = errno; ++ error_cause = ERR_FOUT; + break; ++ } + nwritten += err; + got += err; + +@@ -1046,17 +1054,17 @@ + + _ftp_transfer_stats_cleanup(&trstat); + +- if (ferror(fin) || sig_intr) { +- errno = 0; ++ if (error_cause || sig_intr) { + sig_intr = 0; +- ftp_abort(fin); +- return -1; +- } +- else if (ferror(fout)) { +- err = errno; +- errno = 0; + ftp_abort(fin); +- disp_status("write error: %s", strerror(err)); ++ switch (error_cause) { ++ case ERR_FIN: ++ disp_status("read error: %s", strerror(errno_copy)); ++ break; ++ case ERR_FOUT: ++ disp_status("write error: %s", strerror(errno_copy)); ++ break; ++ } + return -1; + } + |