commit 1b1ef16: [Fix] Read file maps if they were not pre-read during preload

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Nov 11 11:00:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-11-11 10:58:06 +0000
URL: https://github.com/rspamd/rspamd/commit/1b1ef16313c1fca804976ecf77e760807b261fe5 (HEAD -> master)

[Fix] Read file maps if they were not pre-read during preload

---
 src/libserver/maps/map.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/libserver/maps/map.c b/src/libserver/maps/map.c
index d30b2b40d..938f4a47f 100644
--- a/src/libserver/maps/map.c
+++ b/src/libserver/maps/map.c
@@ -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;


More information about the Commits mailing list