Skip to content

Commit

Permalink
Only use fuse_set_log_func() for libfuse >= 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
matt335672 committed Oct 21, 2024
1 parent edd4276 commit b5772ce
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sesman/chansrv/chansrv_fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ int xfuse_path_in_xfuse_fs(const char *path)
#include "list.h"
#include "file.h"

/* Check for FUSE features we may wish to use
*
* Note that FUSE_VERSION might be more useful for some features than
* FUSE_USE_VERSION
*/
#if FUSE_VERSION >= FUSE_MAKE_VERSION(3,7)
#define FUSE_SET_LOG_FUNC_AVAILABLE
#endif

#ifndef EREMOTEIO
#define EREMOTEIO EIO
#endif
Expand Down Expand Up @@ -881,6 +890,7 @@ int xfuse_file_contents_size(int stream_id, int file_size)
* @param fmt Logging format string
* @param ap Arguments for above
*/
#ifdef FUSE_SET_LOG_FUNC_AVAILABLE
static void
xfuse_log_func(enum fuse_log_level fuse_log_level, const char *fmt, va_list ap)
{
Expand Down Expand Up @@ -913,17 +923,20 @@ xfuse_log_func(enum fuse_log_level fuse_log_level, const char *fmt, va_list ap)
vsnprintf(msg, sizeof(msg), fmt, ap);
LOG(level, "%s", msg);
}
#endif //FUSE_SET_LOG_FUNC_AVAILABLE

/**
* Initialize FUSE library
*
* @return 0 on success, -1 on failure
*****************************************************************************/

static int xfuse_init_lib(struct fuse_args *args)
{
int rv = -1;

#ifdef FUSE_SET_LOG_FUNC_AVAILABLE
fuse_set_log_func(xfuse_log_func);
#endif

g_se = fuse_session_new(args, &g_xfuse_ops, sizeof(g_xfuse_ops), 0);
if (g_se == NULL)
Expand Down

0 comments on commit b5772ce

Please sign in to comment.