aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorepoch <epoch@hack.thebackupbox.net>2019-05-31 08:23:35 +0000
committerepoch <epoch@hack.thebackupbox.net>2019-05-31 08:23:35 +0000
commit59719eda50feb3700c2e2ba839c69f79f9659e04 (patch)
tree5da218e244c6c8b1a7e8f44446e7a58935b47aa3
parentbfccf0ca4c240a1664fc9957482301865d0d03e8 (diff)
downloadlibidc-59719eda50feb3700c2e2ba839c69f79f9659e04.tar.gz
libidc-59719eda50feb3700c2e2ba839c69f79f9659e04.zip
call line_handler with NULL pointer for EOF
-rw-r--r--libidc.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libidc.c b/libidc.c
index b46e0d8..96cdc3d 100644
--- a/libidc.c
+++ b/libidc.c
@@ -176,23 +176,27 @@ int select_on_everything() {
if(libline.fds[i].fd == -1) continue;//skip -1s
if(!FD_ISSET(libline.fds[i].fd,&readfs)) continue;//did not find one. hurry back to the for loop
j--;//we found one. trying to get j==0 so we can get out of here early.
- if(libline.fds[i].read_lines_for_us == 0) {
- libline.fds[i].line_handler(&libline.fds[i],0);//the line pointer is null.
- continue;//we don't need to read the line.
- }
+ //if(libline.fds[i].read_lines_for_us == 0) {
+ // libline.fds[i].line_handler(&libline.fds[i],0);//the line pointer is null.
+ // continue;//we don't need to read the line.
+ //}
+ fprintf(stderr,"attempting to read from fd: %d\n",libline.fds[i].fd);
if((n=read(libline.fds[i].fd,libline.fds[i].buffer,CHUNK)) < 0) {
snprintf(tmp,sizeof(tmp)-1,"fd %d: read perror:",libline.fds[i].fd);//hopefully this doesn't error and throw off error messages.
perror(tmp);
return 2;
}
+ fprintf(stderr,"read %d bytes from fd: %d\n",n,libline.fds[i].fd);
if(n == 0) {
fprintf(stderr,"reached EOF on fd: %d\n",libline.fds[i].fd);
if(libline.fds[i].keep_open) {
- tmpfp=fdopen(libline.fds[i].fd,"r");
- clearerr(tmpfp);
+ //tmpfp=fdopen(libline.fds[i].fd,"r");
+ //lseek(libline.fds[i].fd,SEEK_SET,0);
+ //clearerr(tmpfp);
//fuck if I know...
} else {
//we need some way to keep it open on EOF.
+ if(libline.fds[i].line_handler) libline.fds[i].line_handler(&libline.fds[i],0);//dunno
libline.fds[i].fd=-1;//kek
//return 3;
}