From 7414e516c26a247eefb1fd97839c547c2d8803d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Fri, 4 May 2018 00:11:34 +0200 Subject: [PATCH] Track the number of times a sparsebundle has been opened using uintmax_t Instead of off_t, which doesn't make sense, being both unsigned and not a very logical type to use for a counter. --- sparsebundlefs.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sparsebundlefs.cpp b/sparsebundlefs.cpp index d874646..2c0df8a 100644 --- a/sparsebundlefs.cpp +++ b/sparsebundlefs.cpp @@ -56,7 +56,7 @@ struct sparsebundle_t { char *mountpoint; size_t band_size; size_t size; - off_t times_opened; + uintmax_t times_opened; #if FUSE_SUPPORTS_ZERO_COPY map open_files; #endif @@ -370,6 +370,7 @@ static int sparsebundle_release(const char *path, struct fuse_file_info *) { sparsebundle_t *sparsebundle = sparsebundle_current(); + assert(sparsebundle->times_opened); sparsebundle->times_opened--; syslog(LOG_DEBUG, "closed %s%s, now referenced %ju times", sparsebundle->mountpoint, path, uintmax_t(sparsebundle->times_opened));