Re: RFC: Port of NetBSD cat(1)'s -f option.

Peter Pentchev <[email protected]>
Newsgroups gmane.os.freebsd.devel.audit
Message-ID <[email protected]>
On Thu, May 16, 2002 at 02:14:05PM +0200, Dag-Erling Smorgrav wrote:
> Peter Pentchev <[email protected]> writes:
> > Also, aren't we supposed to test the return values of syscalls explicitly
> > against -1, and not just < 0?
> 
> 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

-- 
Peter Pentchev	[email protected]	[email protected]
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?
signature.asc (application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (FreeBSD)

iD8DBQE846TR7Ri2jRYZRVMRAsAoAJ9J/SvWvVtjiKTPGKkU2uxAoBQUnwCgnLlv
c9kiXUlEwmKEqfMm0+4ie7o=
=Ig8u
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.