Skip to content

Commit

Permalink
old-stats: Set process dumpable during stats gathering
Browse files Browse the repository at this point in the history
/proc/self/io is not accessible otherwise
  • Loading branch information
cmouse authored and villesavolainen committed Feb 12, 2018
1 parent 07e1266 commit 977a292
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plugins/old-stats/mail-stats-fill.c
Expand Up @@ -2,6 +2,7 @@

#include "lib.h"
#include "time-util.h"
#include "restrict-access.h"
#include "stats-plugin.h"
#include "mail-stats.h"

Expand Down Expand Up @@ -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
Expand All @@ -60,6 +65,8 @@ static int process_io_open(void)
}
errno = EACCES;
}
if (!dumpable)
restrict_access_set_dumpable(FALSE);
if (proc_io_fd == -1) {
/* ignore access errors too, certain security options can
prevent root access to this file when not owned by root */
Expand Down

0 comments on commit 977a292

Please sign in to comment.