From: Ralph Ronnquist Date: Sat, 16 Jul 2022 10:11:50 +0000 (+1000) Subject: bug fix EOF handling X-Git-Tag: 0.4~8 X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=e04e9af3b753055468c7549740ace3d115a2fac6;p=rrq%2Ffusefile.git bug fix EOF handling --- diff --git a/fusefile.c b/fusefile.c index a976660..a0f0981 100644 --- a/fusefile.c +++ b/fusefile.c @@ -217,7 +217,7 @@ static int fusefile_read(const char *path, char *buf, size_t size, #endif int i = find_source( off ); if ( i < 0 ) { - return ( off == sources.size )? 0 : -ENOENT; + return ( off == sources.size )? rr : -ENOENT; } if ( sources.array[i].fd < 0 ) { return -ENOENT; @@ -256,6 +256,25 @@ static int fusefile_read(const char *path, char *buf, size_t size, return rr; } +/** + * Poll for IO readiness. + */ +int fusefile_poll(const char *path, struct fuse_file_info *fi, + struct fuse_pollhandle *ph, unsigned *reventsp ) +{ +#if DEBUG + fprintf( stderr, "fusefile_poll( %s ) %p %d\n", path, ph, *reventsp ); +#endif + if( strcmp( path, "/" ) != 0 ) { + return -ENOENT; + } + if ( ph ) { + return fuse_notify_poll( ph ); + } + return 0; +} + + /** * Write a full block of data over the sources at the offset */ @@ -397,6 +416,7 @@ static struct fuse_operations fusefile_oper = { .chmod = fusefile_chmod, .open = fusefile_open, .read = fusefile_read, + .poll = fusefile_poll, .write = fusefile_write, .write_buf = fusefile_write_buf, .destroy = fusefile_destroy,