Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!sumax!polari!6sigma!blm From: blm@6sigma.UUCP (Brian Matthews) Newsgroups: comp.unix.wizards Subject: Re: ENOTTY error when executing cp(1) Message-ID: <301@6sigma.UUCP> Date: 13 Sep 89 06:36:00 GMT References: <507@fdmetd.uucp> <2556@taux01.UUCP> Reply-To: blm@6sigma.UUCP (Brian Matthews) Organization: Six Sigma CASE, Inc. Lines: 20 In article <2556@taux01.UUCP> amos@taux01.UUCP (Amos Shapir) writes: |1. Errno is meaningful only after a system call fails; ENOTTY is usually | generated in the normal course of starting up stdio. To make sure | its value is relevant, always clear errno before doing a system call. Is it guarenteed anywhere that errno is left untouched if a system call succeeds? I couldn't find it. Intro(2) (in my System V manuals) states: "Errno is not cleared on successful calls, so it should be tested only after an error has been indicated." The second half of that sentence says to me that errno may be modified even if the system call succeeds, so relying on errno staying zero is a Bad Thing. But the first half of the sentence seems to talk about clearing errno on success, so the second half might not say anything about whether errno is modified on success. -- Brian L. Matthews blm@6sigma.UUCP Six Sigma CASE, Inc. +1 206 854 6578 PO Box 40316, Bellevue, WA 98004