Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2002 15:23:45 +0300
From:      Peter Pentchev <roam@ringlet.net>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        Bruce Evans <bde@zeta.org.au>, Giorgos Keramidas <keramida@FreeBSD.ORG>, Mike Makonnen <makonnen@pacbell.net>, freebsd-audit@FreeBSD.ORG
Subject:   Re: RFC: Port of NetBSD cat(1)'s -f option.
Message-ID:  <20020516152345.E349@straylight.oblivion.bg>
In-Reply-To: <xzpznz0thma.fsf@flood.ping.uio.no>; from des@ofug.org on Thu, May 16, 2002 at 02:14:05PM %2B0200
References:  <20020515211758.GB68380@hades.hell.gr> <20020516164332.B1704-100000@gamplex.bde.org> <20020516134044.A349@straylight.oblivion.bg> <xzpznz0thma.fsf@flood.ping.uio.no>

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

--2qXFWqzzG3v1+95a
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, May 16, 2002 at 02:14:05PM +0200, Dag-Erling Smorgrav wrote:
> Peter Pentchev <roam@ringlet.net> writes:
> > Also, aren't we supposed to test the return values of syscalls explicit=
ly
> > against -1, and not just < 0?
>=20
> Is a negative return value different from -1 more correct than -1?
> Should it be silently ignored?

Hmm.  The standards (and our manual pages) say that most syscalls
return *exactly* -1 on error.  A negative value different than -1
should be treated as some kind of meta-error; maybe something
that might warrant an err(EX_OSERR, ...).  No, I do not really
think that it is possible - or even thinkable - to make that check
every time a syscall is invoked :)

Actually, now I don't know what to think - for the past few months,
I have been writing my own programs with explicit checks for -1.
Is there an OS out there that returns negative values other than -1?
I presume that no *new* OS and no new syscalls will be written to
return such, so no further incompatibility would be introduced;
but is there an existing platform that would break programs which
check explicitly for -1?

G'luck,
Peter

--=20
Peter Pentchev	roam@ringlet.net	roam@FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
What would this sentence be like if it weren't self-referential?

--2qXFWqzzG3v1+95a
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE846TR7Ri2jRYZRVMRAsAoAJ9J/SvWvVtjiKTPGKkU2uxAoBQUnwCgnLlv
c9kiXUlEwmKEqfMm0+4ie7o=
=Ig8u
-----END PGP SIGNATURE-----

--2qXFWqzzG3v1+95a--

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




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