example/notify_store_retrieve: add debugging code for issue #105.

This commit is contained in:
Nikolaus Rath 2017-05-31 12:54:19 -07:00
parent e6dd8ceb9e
commit 7d09db0e46

View File

@ -300,6 +300,7 @@ static void update_fs(void) {
static void* update_fs_loop(void *data) {
struct fuse_session *se = (struct fuse_session*) data;
struct fuse_bufvec bufv;
int ret;
while(1) {
update_fs();
@ -312,8 +313,15 @@ static void* update_fs_loop(void *data) {
bufv.buf[0].size = file_size;
bufv.buf[0].mem = file_contents;
bufv.buf[0].flags = 0;
assert(fuse_lowlevel_notify_store(se, FILE_INO, 0,
&bufv, 0) == 0);
/* This shouldn't fail, but apparenly it sometimes
does - see https://github.com/libfuse/libfuse/issues/105 */
ret = fuse_lowlevel_notify_store(se, FILE_INO, 0, &bufv, 0);
if (ret != 0) {
fprintf(stderr, "ERROR: fuse_lowlevel_notify_store() failed with %s (%d)\n",
strerror(-ret), -ret);
abort();
}
/* To make sure that everything worked correctly, ask the
kernel to send us back the stored data */