From aad19e05abe1afc75bc7c5f4646b9eee4d791cd3 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Thu, 8 Feb 2018 13:04:48 +0200 Subject: [PATCH] old-stats: Set process dumpable during stats gathering /proc/self/io is not accessible otherwise --- src/plugins/stats/mail-stats-fill.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/stats/mail-stats-fill.c b/src/plugins/stats/mail-stats-fill.c index b12b1c73cc..f9933501d7 100644 --- a/src/plugins/stats/mail-stats-fill.c +++ b/src/plugins/stats/mail-stats-fill.c @@ -2,6 +2,7 @@ #include "lib.h" #include "time-util.h" +#include "restrict-access.h" #include "stats-plugin.h" #include "mail-stats.h" @@ -45,6 +46,10 @@ static int process_io_open(void) if (proc_io_disabled) return -1; + + bool dumpable = restrict_access_get_dumpable(); + if (!dumpable) + restrict_access_set_dumpable(TRUE); proc_io_fd = open(PROC_IO_PATH, O_RDONLY); if (proc_io_fd == -1 && errno == EACCES) { /* kludge: if we're running with permissions temporarily @@ -60,6 +65,8 @@ static int process_io_open(void) } errno = EACCES; } + if (!dumpable) + restrict_access_set_dumpable(FALSE); if (proc_io_fd == -1) { if (errno != ENOENT) i_error("open(%s) failed: %m", PROC_IO_PATH); -- 2.47.3