am c734ac27: am c3d61786: Merge "crash_reporter: Run with supplemental groups"

* commit 'c734ac274aca9c9dbe299d85881a54b333d083cf':
  crash_reporter: Run with supplemental groups
This commit is contained in:
Steve Fung 2015-08-25 23:08:55 +00:00 committed by Android Git Automerger
commit f079143b29
1 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <stdint.h>
#include <sys/cdefs.h> // For __WORDSIZE
#include <sys/types.h> // For getpwuid_r, getgrnam_r, WEXITSTATUS.
#include <unistd.h> // For setgroups
#include <string>
#include <vector>
@ -37,6 +38,7 @@
#include <chromeos/process.h>
#include <chromeos/syslog_logging.h>
#include <cutils/properties.h>
#include <private/android_filesystem_config.h>
static const char kCollectionErrorSignature[] =
"crash_reporter-user-collection";
@ -77,6 +79,11 @@ void UserCollector::Initialize(
core2md_failure_ = core2md_failure;
directory_failure_ = directory_failure;
filter_in_ = filter_in;
gid_t groups[] = { AID_SYSTEM, AID_DBUS };
if (setgroups(arraysize(groups), groups) != 0) {
PLOG(FATAL) << "Unable to set groups to system and dbus";
}
}
UserCollector::~UserCollector() {