Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!apple!motcsd!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.unix.wizards Subject: Re: ENOTTY error when executing cp(1) Message-ID: <14020075@hpisod2.HP.COM> Date: 13 Sep 89 05:56:20 GMT References: <507@fdmetd.uucp> Organization: Hewlett Packard, Cupertino Lines: 20 > There's a combination of two common errors here: > > 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. No. To make sure its value is relevant, only use it when it is meaningful; i.e., when a function returns a documented error return value and says that it sets errno in its documentation. Clearing errno is irrelevant except where it is the only way to detect errors (as in functions that use all possible return values for successful completions). > 2. Despite its name, system() is not a system call, but a routine; > its return value is the shell's exit status, which is usually specific > to the command it runs. Errno has nothing to do with it. RTFM. Yes. Dave