* EPIPE on fread...Why? (CERN httpd)
@ 1996-04-09 20:24 Sean Watson
0 siblings, 0 replies; only message in thread
From: Sean Watson @ 1996-04-09 20:24 UTC (permalink / raw)
To: tru64-unix-managers
Hi,
I've got a program that's calling fread(3) on a pipe and returning
-1. When ferror(3) is called on the file descriptor, I get EPIPE (32).
The man page for fread(3) refers me to putc(3) which says you get an EPIPE
when you try to write to a pipe whose reading end has been closed. The
same goes for the intro(2) man page. Grepping through the man pages for
EPIPE yeilds
fclose(3), fputws(3), fseek(3), printf(3), putc(3), puts(3), putwc(3),
intro(2), write(2) but NOTHING that has much to do with read/fread.
What makes fread set errno to EPIPE? Is EPIPE safe to ignore when it
is generated by fread (right now I've patched it to do this)?
Thanks,
Sean
P.S. The pogram is CERN httpd. I have applied the kludge/patch they mention
(ie, I've added a sleep(1) to the HTScript.c file) but this dosn't solve
all the problems or tell me why it is happening.
P.P.S. Here are the pertinent (slightly modified) code fragments:
int pout[0];
FILE *fp;
pipe(pout);
/* ... */
fp = fdopen(pout[0], "r");
/* ... */
for (;;)
{
int status = fread(input_buffer, 1, INPUT_BUFFER_SIZE, fp);
if (status == 0) { /* EOF or error */
if (ferror(fp) == 0) break;
#ifdef osf_fread_fix
if (ferror(fp) == EPIPE) continue;
#endif
fprintf(stderr,"HTLoadScriptResult: Read error, read returns %d\n",
ferror(fp));
break;
}
/* ... */
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1996-04-09 20:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-04-09 20:24 EPIPE on fread...Why? (CERN httpd) Sean Watson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox