Mercurial > dovecot > core-2.2
changeset 22827:ce305d3d9b52
old-stats: Set process dumpable during stats gathering
/proc/self/io is not accessible otherwise
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Thu, 08 Feb 2018 13:04:48 +0200 |
parents | 44e84dd9b363 |
children | b562bf4b2513 |
files | src/plugins/stats/mail-stats-fill.c |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/stats/mail-stats-fill.c Thu Feb 08 13:03:37 2018 +0200 +++ b/src/plugins/stats/mail-stats-fill.c Thu Feb 08 13:04:48 2018 +0200 @@ -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 @@ 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 @@ } 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);