diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2004-07-29 09:27:49 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2004-07-29 09:27:49 +0000 |
commit | 891b874eedcc9f49364d12b4773e01a8b013fb67 (patch) | |
tree | 50d6c85719f8abdaaa91378f0d37c6d36eeedefd /example/hello.c | |
parent | 94ed76ad4ae5c44a5b087b64f5dbf325f892f503 (diff) |
add fuse_invalidate() to library API
Diffstat (limited to 'example/hello.c')
-rw-r--r-- | example/hello.c | 10 |
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; } |