Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!accuvax.nwu.edu!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: friendly messages Message-ID: <16625@mimsy.UUCP> Date: 30 Mar 89 04:16:50 GMT References: <435@laic.UUCP> <955@auspex.UUCP> <9218@bloom-beacon.MIT.EDU> <1411@moscom.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 21 In article <1411@moscom.UUCP> jgp@moscom.UUCP (Jim Prescott) writes: [much deleted; these are retained in order] > ret = vsprintf(buf, fmt, ap); > fprintf(stderr, "%s: %s", Progname, buf); > perror(""); Beware, beware! His flashing eyes, his floating exception! Oops, a bit of stream of unconsciousness there. This can produce the infamous sendmail-style message: Cannot exec /bin/mail: Not a typewriter because fprintf() can call isatty() which can set errno to ENOTTY. To fix this you should either save and restore errno, or change the code to fish the error message directly out of sys_errmsg[], or use strerror() (if your C library has it). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris