From a426ea6dadd4d49b69d0858b511b9b7402858016 Mon Sep 17 00:00:00 2001 From: bol-van Date: Sun, 4 May 2025 22:01:00 +0300 Subject: [PATCH] nfqws,tpws: check list files accessibility after all params are parsed --- nfq/hostlist.c | 2 ++ nfq/nfqws.c | 3 +++ tpws/hostlist.c | 2 ++ tpws/tpws.c | 3 +++ 4 files changed, 10 insertions(+) diff --git a/nfq/hostlist.c b/nfq/hostlist.c index 3de71b7a..5518f712 100644 --- a/nfq/hostlist.c +++ b/nfq/hostlist.c @@ -287,11 +287,13 @@ static struct hostlist_file *RegisterHostlist_(struct hostlist_files_head *hostl } struct hostlist_file *RegisterHostlist(struct desync_profile *dp, bool bExclude, const char *filename) { +/* if (filename && !file_mod_time(filename)) { DLOG_ERR("cannot access hostlist file '%s'\n",filename); return NULL; } +*/ return RegisterHostlist_( ¶ms.hostlists, bExclude ? &dp->hl_collection_exclude : &dp->hl_collection, diff --git a/nfq/nfqws.c b/nfq/nfqws.c index a6dcbef8..16c1850f 100644 --- a/nfq/nfqws.c +++ b/nfq/nfqws.c @@ -2887,6 +2887,9 @@ int main(int argc, char **argv) #endif } + if (!test_list_files()) + exit_clean(1); + if (!LoadAllHostLists()) { DLOG_ERR("hostlists load failed\n"); diff --git a/tpws/hostlist.c b/tpws/hostlist.c index 08a9d2f3..b1bc8fdd 100644 --- a/tpws/hostlist.c +++ b/tpws/hostlist.c @@ -287,11 +287,13 @@ static struct hostlist_file *RegisterHostlist_(struct hostlist_files_head *hostl } struct hostlist_file *RegisterHostlist(struct desync_profile *dp, bool bExclude, const char *filename) { +/* if (filename && !file_mod_time(filename)) { DLOG_ERR("cannot access hostlist file '%s'\n",filename); return NULL; } +*/ return RegisterHostlist_( ¶ms.hostlists, bExclude ? &dp->hl_collection_exclude : &dp->hl_collection, diff --git a/tpws/tpws.c b/tpws/tpws.c index 0a353bce..0b769d94 100644 --- a/tpws/tpws.c +++ b/tpws/tpws.c @@ -1638,6 +1638,9 @@ void parse_params(int argc, char *argv[]) } #endif + if (!test_list_files()) + exit_clean(1); + if (!LoadAllHostLists()) { DLOG_ERR("hostlists load failed\n");