Re: zmailer and _fileno
On Tue, Jul 31, 2001 at 08:24:47AM -0700, James Morrison wrote:
> Here is a tidbit from zmailer.
> FILE f;
> #if defined(__GNU_LIBRARY__) || defined(__GLIBC__)
> f._fileno = ioop->fd
> #else
> f.file = ioop->fd /* for sysIII systems */
> #endif
>
> This is a section of the code. I'll look around today for any
> instances of fileno or _fileno to see how else people try to use it.
Yuck! Fix it, fix it, FIX IT! Change it to:
FILE *f;
f = fdopen (ioop->fd, "mode");
replacing "mode" with the standard fopen "mode" semantics. The
fdopen(3) call is defined in POSIX.1, so reasonable systems since
1988(!) should support it quite well by now.
-- sparky
Reply to: