Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!husc6!hao!oddjob!gargoyle!ihnp4!homxb!whuts!mike
From: mike@whuts.UUCP (BALDWIN)
Newsgroups: comp.lang.c
Subject: Re: Weird syscall returns
Message-ID: <2384@whuts.UUCP>
Date: Fri, 10-Jul-87 14:09:24 EDT
Article-I.D.: whuts.2384
Posted: Fri Jul 10 14:09:24 1987
Date-Received: Sun, 12-Jul-87 13:13:44 EDT
References: <1158@copper.TEK.COM> <6858@auspyr.UUCP> <17171@cca.CCA.COM> <428@sds.SciCom.MN.ORG>
Organization: AT&T Bell Laboratories
Lines: 14
Summary: nice isn't nice

> >     I can think of no Unix system call that doesn't return -1 on error.
> What about nice()?

No, nice() *does* return -1 on error, so the original statement is true.
Unfortunately, it returns -1 on success (sometimes), which is a real pain.
The only way to be sure is to set errno to 0, then if nice returns -1 AND
errno is set, you have an error.  Yecch!  Although I'm just as queasy
about char *sbrk(), char *shmat(), and void (*signal/set())() returning -1
on error.  [Signal/set has even more rudeness with SIG_IGN (1) and SIG_HOLD
(2).  Hiding the rudeness with #define's (ala SIG_ERR (-1)) doesn't fix it.]
-- 
						Michael Scott Baldwin
			(not the opinions of)	AT&T Bell Laboratories
						{at&t}!whuts!mike