From 7d09db0e46e72ac86123dc8012cf04a35e1c93e3 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Wed, 31 May 2017 12:54:19 -0700 Subject: [PATCH] example/notify_store_retrieve: add debugging code for issue #105. --- example/notify_store_retrieve.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/example/notify_store_retrieve.c b/example/notify_store_retrieve.c index 440a7f8..0ed22bb 100644 --- a/example/notify_store_retrieve.c +++ b/example/notify_store_retrieve.c @@ -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 */