Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!pyramid!hplabs!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.lang.c Subject: Re: Re: Question on ANSI C compatibility (really return values and errno) Message-ID: <2550037@hpisod2.HP.COM> Date: 17 Dec 87 01:20:05 GMT References: <1853@haddock.ISC.COM> Organization: Hewlett Packard, Cupertino Lines: 21 > I wrote: > > errno = 0; > > unlink(fname); > > if (errno != 0) abort(); > and was informed that this is unportable usage because the POSIX spec > doesn't guarantee that functions will preserve errno on success. This is true of POSIX, and of almost all historical UNIX implementations. > Tell me then, o POSIX gurus, whether there are still functions that can > return -1 on success (e.g. ptrace() and possibly nice())? If so, does > POSIX specify what these functions are allowed to do with errno in such > a case? I don't believe POSIX (P1003.1) specifies any such functions, except possibly sigaction() and signal(), depending on what constants you use for SIG_ERR, SIG_DFL, and SIG_IGN. Dave Decot P1003.1 Working Group Member hpda!decot