Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jan 2012 12:18:10 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Dag-Erling Smorgrav <des@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r230307 - in head: lib/libfetch usr.bin/fetch
Message-ID:  <20120121111809.GB1723@garage.freebsd.pl>
In-Reply-To: <201201181513.q0IFDMb1045392@svn.freebsd.org>
References:  <201201181513.q0IFDMb1045392@svn.freebsd.org>

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

--0ntfKIWw70PvrIHh
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 18, 2012 at 03:13:22PM +0000, Dag-Erling Smorgrav wrote:
> Author: des
> Date: Wed Jan 18 15:13:21 2012
> New Revision: 230307
> URL: http://svn.freebsd.org/changeset/base/230307
>=20
> Log:
>   Fix two issues related to the use of SIGINFO in fetch(1) to display
>   progress information.  The first is that fetch_read() (used in the HTTP
>   code but not the FTP code) can enter an infinite loop if it has previou=
sly
>   been interrupted by a signal.  The second is that when it is interrupte=
d,
>   fetch_read() will discard any data it may have read up to that point.
>   Luckily, both bugs are extremely timing-sensitive and therefore difficu=
lt
>   to trigger.
>  =20
>   PR:		bin/153240
>   Submitted by:	Mark <markjdb@gmail.com>
>   MFC after:	3 weeks
[...]
> +static int
> +fetch_cache_data(conn_t *conn, char *src, size_t nbytes)
> +{
> +	char *tmp;
> +
> +	if (conn->cache.size < nbytes) {
> +		tmp =3D realloc(conn->cache.buf, nbytes);
> +		if (tmp =3D=3D NULL) {
> +			errno =3D ENOMEM;

realloc(3) on failures sets errno to ENOMEM for you already.

> +		conn->cache.len -=3D total;
> +		conn->cache.pos +=3D total;
> +		len -=3D total;
> +		buf+=3D total;

Style nit (missing space before +=3D).

--=20
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl

--0ntfKIWw70PvrIHh
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)

iEYEARECAAYFAk8anvEACgkQForvXbEpPzT5wACfYqA6AdeqJcQo0pkRIRWG+NQL
m3AAoMucxtqJSBCQYSgRPlJZZWSGZnNj
=cSPT
-----END PGP SIGNATURE-----

--0ntfKIWw70PvrIHh--



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