From ad5d6413a7ac78a7d6a44bb38bd74fa2d41dc1b4 Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Fri, 6 Oct 2017 16:05:01 -0700 Subject: [PATCH] If no group is specified, use the user's primary group --- minidlna.c | 4 ++++ monitor.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/minidlna.c b/minidlna.c index 48e56ff..f82cd89 100644 --- a/minidlna.c +++ b/minidlna.c @@ -734,6 +734,8 @@ init(int argc, char **argv) DPRINTF(E_FATAL, L_GENERAL, "Bad user '%s'.\n", ary_options[i].value); uid = entry->pw_uid; + if (!gid) + gid = entry->pw_gid; } break; case FORCE_SORT_CRITERIA: @@ -873,6 +875,8 @@ init(int argc, char **argv) if (!entry) DPRINTF(E_FATAL, L_GENERAL, "Bad user '%s'.\n", argv[i]); uid = entry->pw_uid; + if (!gid) + gid = entry->pw_gid; } } else diff --git a/monitor.c b/monitor.c index b3a17f5..51e66fc 100644 --- a/monitor.c +++ b/monitor.c @@ -571,12 +571,12 @@ monitor_remove_directory(int fd, const char * path) /* Invalidate the scanner cache so we don't insert files into non-existent containers */ valid_cache = 0; + #ifdef HAVE_INOTIFY if( fd > 0 ) { - #ifdef HAVE_INOTIFY remove_watch(fd, path); - #endif } + #endif sql = sqlite3_mprintf("SELECT ID from DETAILS where (PATH > '%q/' and PATH <= '%q/%c')" " or PATH = '%q'", path, path, 0xFF, path); if( (sql_get_table(db, sql, &result, &rows, NULL) == SQLITE_OK) )