ENOTTY error when executing cp(1)
Dave Decot
decot at hpisod2.HP.COM
Wed Sep 13 15:56:20 AEST 1989
> 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
More information about the Comp.unix.wizards
mailing list