From: Emden Gansner Date: Wed, 13 Feb 2013 19:40:05 +0000 (-0500) Subject: Try to fix bug 2256. Remove file descriptor polling from gvdevice_xlib.c X-Git-Tag: LAST_LIBGRAPH~32^2~234 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=476644e2f962017b7f520e2be0f0d2cdb5557e77;p=graphviz Try to fix bug 2256. Remove file descriptor polling from gvdevice_xlib.c and have cgraph use FILE* for reading. --- diff --git a/lib/cgraph/io.c b/lib/cgraph/io.c index efaef6b2c..cb44e6c7f 100644 --- a/lib/cgraph/io.c +++ b/lib/cgraph/io.c @@ -68,7 +68,11 @@ static int iofreadiconv(void *chan, char *buf, int bufsize) static int iofread(void *chan, char *buf, int bufsize) { - return read(fileno((FILE *) chan), buf, bufsize); + if (fgets(buf, bufsize, (FILE*)chan)) + return strlen(buf); + else + return 0; + /* return read(fileno((FILE *) chan), buf, bufsize); */ /* return fread(buf, 1, bufsize, (FILE*)chan); */ } diff --git a/plugin/xlib/gvdevice_xlib.c b/plugin/xlib/gvdevice_xlib.c index 417f3e128..a73e648cd 100644 --- a/plugin/xlib/gvdevice_xlib.c +++ b/plugin/xlib/gvdevice_xlib.c @@ -47,9 +47,11 @@ #include #endif +#if 0 #ifdef WITH_CGRAPH #include #endif +#endif #include "gvplugin_device.h" @@ -380,19 +382,8 @@ static int handle_stdin_events(GVJ_t *job, int stdin_fd) { int rc=0; -#ifndef WITH_CGRAPH if (feof(stdin)) return -1; -#else - struct pollfd ufds[2]; - int r; - ufds[0].fd = stdin_fd; - ufds[0].events = POLLIN; - ufds[0].revents = 0; - r = poll(ufds,1,0); - if (ufds[0].revents & POLLIN) return -1; - /* Beware of bugs in the above code; I have only proved it correct, not tried it. */ -#endif (job->callbacks->read)(job, job->input_filename, job->layout_type); rc++;