Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Nov 2012 09:08:47 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Eitan Adler <eadler@freebsd.org>
Cc:        svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   Re: svn commit: r243210 - stable/9/usr.sbin/ndiscvt
Message-ID:  <20121118070847.GF73505@kib.kiev.ua>
In-Reply-To: <201211180621.qAI6LkxT068557@svn.freebsd.org>
References:  <201211180621.qAI6LkxT068557@svn.freebsd.org>

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

--c2/+NrNR1GxQl8IM
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Nov 18, 2012 at 06:21:46AM +0000, Eitan Adler wrote:
> Author: eadler
> Date: Sun Nov 18 06:21:45 2012
> New Revision: 243210
> URL: http://svnweb.freebsd.org/changeset/base/243210
>=20
> Log:
>   MFC r243074:
>   	Add a missing check for fread
>  =20
>   Approved by:	cperciva (implicit)
>=20
> Modified:
>   stable/9/usr.sbin/ndiscvt/ndiscvt.c
> Directory Properties:
>   stable/9/usr.sbin/ndiscvt/   (props changed)
>=20
> Modified: stable/9/usr.sbin/ndiscvt/ndiscvt.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- stable/9/usr.sbin/ndiscvt/ndiscvt.c	Sun Nov 18 05:19:08 2012	(r243209)
> +++ stable/9/usr.sbin/ndiscvt/ndiscvt.c	Sun Nov 18 06:21:45 2012	(r243210)
> @@ -325,6 +325,8 @@ main(int argc, char *argv[])
>  	rewind (fp);
>  	img =3D calloc(fsize, 1);
>  	n =3D fread (img, fsize, 1, fp);
> +	if (n =3D=3D 0)
> +		err(1, "reading .SYS file '%s' failed", sysfile);
> =20
AFAIR fread(3) can return 0 both for error and EOF. In the later case, errno
is meaningless. Is the short read case fatal ?

--c2/+NrNR1GxQl8IM
Content-Type: application/pgp-signature

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

iQIcBAEBAgAGBQJQqIl/AAoJEJDCuSvBvK1BNisP/iLBDmFpziiVTU8dGl+cSQ5J
VV7XKVr5Njf157JMbE8oFoylc1xGosj3pEJDi4KAnjsRwT244AaMqexeN5WyJ1Gx
tL2xr+cM/oz8VGUnhdgVf+fZOg04o4l2nxMNDCI5y5GMrHMuO4nvJ9kZ81rO2JX8
ZH11HdHcbT/IVVHfEl90e+XRpqF0O8i1mf2HB9TOHQJolRLJqF/XUE+PAvqS5rQb
E+xGTeOgw3dbUgkY8Jteg0T6iDSLaxmHBfkVkOCKQWfVjfIAWJ35tg5SYMIVzy7q
Wjwo9PmNm8N8RKP9VTf3GupbHXU2C1fjWtcNNjLuj5aLm++EQpMp66mS3/eZCGkU
ZfwVjVCd37Oq0jHmYrtFm0MVg3ZuiU7xaqtCJnDn8d8vmoh5mqhxzCjslcitiQ4V
7hizRE8gXF8npj4RiYo7DeeKV03Vh0XTIZq5UHzv6P0ldHLQq6X6yZT+GWDk202s
iqu5eK6Drsd8YcKyBAfvsxj1hs6KWEbhbkuIL7jLhRGDwuER1iEKR1bL1M26ssmy
0aWrWa7TzSTXYgP221hQjQfQEK7MTJSCjGSnlzHj00rjfh+mXvXDN4u2IWwnYup+
UaFTafyLG3njNrKK2GyTWTiG/27yVs9aq3nIbqPEj+qooT18s1boinT/ED8Sz8bD
EWvREYpCvfmtIuhZ/z1S
=gwVz
-----END PGP SIGNATURE-----

--c2/+NrNR1GxQl8IM--



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