]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Read file maps if they were not pre-read during preload
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 11 Nov 2021 10:58:06 +0000 (10:58 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 11 Nov 2021 10:58:06 +0000 (10:58 +0000)
src/libserver/maps/map.c

index d30b2b40d1497a6d8332c5bd197de1d977010336..938f4a47fd225fd1ceb9a38577f4d6fbeaf50478 100644 (file)
@@ -2155,6 +2155,15 @@ rspamd_map_watch (struct rspamd_config *cfg,
 
                                data = bk->data.fd;
 
+                               if (map->user_data == NULL || *map->user_data == NULL) {
+                                       /* Map has not been read, init it's reading if possible */
+                                       struct stat st;
+
+                                       if (stat (data->filename, &st) != -1) {
+                                               data->need_modify = TRUE;
+                                       }
+                               }
+
                                ev_stat_init (&data->st_ev, rspamd_map_on_stat,
                                                data->filename, map->poll_timeout * cfg->map_file_watch_multiplier);
                                data->st_ev.data = map;