From ff7d6e7af23fe4cc0006cc0b0b4bcb5590bbaa35 Mon Sep 17 00:00:00 2001 From: wbaumann Date: Sat, 10 Aug 2013 10:54:58 +0000 Subject: [PATCH] Assign buf_size before using it --- src/kernel_interface.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/kernel_interface.c b/src/kernel_interface.c index f7a958d..c03128d 100644 --- a/src/kernel_interface.c +++ b/src/kernel_interface.c @@ -182,6 +182,15 @@ dav_init_kernel_interface(const char *url, const char *mpoint, syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Initializing kernel interface"); + buf_size = args->buf_size * 1024; + if (buf_size < (FUSE_MIN_READ_BUFFER + 4096)) + buf_size = FUSE_MIN_READ_BUFFER + 4096; + buf = malloc(buf_size); + if (!buf) + error(EXIT_FAILURE, errno, _("can't allocate message buffer")); + + idle_time = args->delay_upload; + char *path = xasprintf("%s/%s", DAV_DEV_DIR, FUSE_DEV_NAME); fuse_device = open(path, O_RDWR | O_NONBLOCK); @@ -211,15 +220,6 @@ dav_init_kernel_interface(const char *url, const char *mpoint, error(EXIT_FAILURE, errno, _("mounting failed")); free(mdata); - - buf_size = args->buf_size * 1024; - if (buf_size < (FUSE_MIN_READ_BUFFER + 4096)) - buf_size = FUSE_MIN_READ_BUFFER + 4096; - buf = malloc(buf_size); - if (!buf) - error(EXIT_FAILURE, errno, _("can't allocate message buffer")); - - idle_time = args->delay_upload; }