From 891b874eedcc9f49364d12b4773e01a8b013fb67 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Thu, 29 Jul 2004 09:27:49 +0000 Subject: add fuse_invalidate() to library API --- example/hello.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'example/hello.c') 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; } -- cgit v1.2.3