From d6374fa4e2e8d40a9e316175bb1155ace5d2bdd8 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Fri, 29 Dec 2017 15:20:09 -0800 Subject: [PATCH] Fix SQL queries that intended to match directories. Code originates from FreeBSD ports extra patch. Probably it was working on previous versions of SQLite, or on previous minidlna schema. --- monitor_kqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitor_kqueue.c b/monitor_kqueue.c index 00652f7..c88092f 100644 --- a/monitor_kqueue.c +++ b/monitor_kqueue.c @@ -49,7 +49,7 @@ dir_vnode_process(struct event *ev, u_int fflags) DPRINTF(E_DEBUG, L_INOTIFY, "Directory [%s] content updated\n", path); sql = sqlite3_mprintf("SELECT PATH from DETAILS where " - "(PATH > '%q/' and PATH <= '%q/%c') and SIZE = ''", + "(PATH > '%q/' and PATH <= '%q/%c') and SIZE IS NULL", path, path, 0xFF); DPRINTF(E_DEBUG, L_INOTIFY, "SQL: %s\n", sql); if ((sql_get_table(db, sql, &result, &rows, NULL) != @@ -112,7 +112,7 @@ dir_vnode_process(struct event *ev, u_int fflags) DPRINTF(E_DEBUG, L_INOTIFY, "File [%s] content updated\n", path); sql = sqlite3_mprintf("SELECT PATH from DETAILS where " - "(PATH > '%q/' and PATH <= '%q/%c') and SIZE <> ''", + "(PATH > '%q/' and PATH <= '%q/%c') and SIZE IS NOT NULL", path, path, 0xFF); if (sql_get_table(db, sql, &result, &rows, NULL) != SQLITE_OK) { DPRINTF(E_WARN, L_INOTIFY,