From b84df9c5c37ff7ef31ef34d6eb5836dc0edf61d0 Mon Sep 17 00:00:00 2001 From: chme Date: Sat, 6 Feb 2016 07:44:19 +0100 Subject: [PATCH] [filescanner] Fix compile error on freebsd --- src/filescanner.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/filescanner.c b/src/filescanner.c index b37ff168..763e9578 100644 --- a/src/filescanner.c +++ b/src/filescanner.c @@ -1380,6 +1380,28 @@ filescanner(void *arg) pthread_exit(NULL); } +static int +get_parent_dir_id(const char *path) +{ + char *pathcopy; + char *parent_dir; + char virtual_path[PATH_MAX]; + int parent_id; + int ret; + + pathcopy = strdup(path); + parent_dir = dirname(pathcopy); + ret = create_virtual_path(parent_dir, virtual_path, sizeof(virtual_path)); + if (ret == 0) + parent_id = db_directory_id_byvirtualpath(virtual_path); + else + parent_id = 0; + + free(pathcopy); + + return parent_id; +} + #if defined(__linux__) static int @@ -1412,28 +1434,6 @@ watches_clear(uint32_t wd, char *path) return 0; } -static int -get_parent_dir_id(const char *path) -{ - char *pathcopy; - char *parent_dir; - char virtual_path[PATH_MAX]; - int parent_id; - int ret; - - pathcopy = strdup(path); - parent_dir = dirname(pathcopy); - ret = create_virtual_path(parent_dir, virtual_path, sizeof(virtual_path)); - if (ret == 0) - parent_id = db_directory_id_byvirtualpath(virtual_path); - else - parent_id = 0; - - free(pathcopy); - - return parent_id; -} - /* Thread: scan */ static void process_inotify_dir(struct watch_info *wi, char *path, struct inotify_event *ie)