ka@hou3c.UUCP (Kenneth Almquist) (11/22/83)
When a program is invoked from cron, the standard input is not openned,
which will confuse some programs. In particular, it will confuse any
program that uses popen to write to a program, at least under System V,
unless you install this fix. Popen forks off a child and then redirects
the standard input or output of the child with code that looks like:
(void) close(stdio);
(void) fcntl(yourside, 0, stdio);
(void) close(yourside);
That code fails if stdio and yourside are identical; the fix is to add
a test for this case:
if (yourside != stdio) {
(void) close(stdio);
(void) fcntl(yourside, 0, stdio);
(void) close(yourside);
}
By the way, the zero in the call to fcntl is the F_DUPFD function which
is the USG means of duplicating a file descriptor.
Kenneth Almquist
{mhtsa,ihnp4}!hou3c!ka