'what' doesn't use perror to print open errors, Sys V/3.0

Dave Decot decot at hpisod2.HP.COM
Tue May 2 08:12:39 AEST 1989


> > (1) "what" uses fopen() to open the file.  perror() is inappropriate
> > except when a system call reports failure.  fopen() is not a system call.
> 
> I regularly use perror() to report the failure of an fopen().  It works on
> all the systems I've used because, of course, the fopen() doesn't make any
> other system calls after the open().  Is this really a bad thing to do?

It's not bad on an X/Open system.

X/Open recognized the widespread use of perror() after library routines
that can experience underlying system errors, and gave this practice
its blessing.

Therefore, systems that claim compliance to Issue III of the X/Open
Portability Guide will set errno for these functions as documented.
Note that IEEE Standard 1003.1 (POSIX) also appears to require this
behavior for systems implementing the Standard C Language Binding.

Dave Decot
Past Chair
X/Open System Interface Working Group



More information about the Comp.bugs.sys5 mailing list