aboutsummaryrefslogtreecommitdiff
path: root/example/hello.c
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2004-07-29 09:27:49 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2004-07-29 09:27:49 +0000
commit891b874eedcc9f49364d12b4773e01a8b013fb67 (patch)
tree50d6c85719f8abdaaa91378f0d37c6d36eeedefd /example/hello.c
parent94ed76ad4ae5c44a5b087b64f5dbf325f892f503 (diff)
add fuse_invalidate() to library API
Diffstat (limited to 'example/hello.c')
-rw-r--r--example/hello.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/example/hello.c b/example/hello.c
index da2a9ee..040c835 100644
--- a/example/hello.c
+++ b/example/hello.c
@@ -60,10 +60,18 @@ static int hello_open(const char *path, int flags)
static int hello_read(const char *path, char *buf, size_t size, off_t offset)
{
+ size_t len;
if(strcmp(path, hello_path) != 0)
return -ENOENT;
- memcpy(buf, hello_str + offset, size);
+ len = strlen(hello_str);
+ if (offset < len) {
+ if (offset + size > len)
+ size = len - offset;
+ memcpy(buf, hello_str + offset, size);
+ } else
+ size = 0;
+
return size;
}