summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2016-01-25 17:17:54 +0100
committerMichael Vogt <mvo@debian.org>2016-01-25 17:17:54 +0100
commit48fe8dff592f6769bf2c67b8e7befd7091068f7d (patch)
tree960bc99e92952f5eff1385792fa236100df717de
parent46e88ba252230858abe891d5815fce884d3cf35d (diff)
Use c++11 for loop in AptHistoryRequestingUser
Git-Dch: ignore
-rw-r--r--apt-pkg/deb/dpkgpm.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 6751e9779..90e33bff4 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -58,15 +58,13 @@ using namespace std;
APT_PURE static string
AptHistoryRequestingUser()
{
- const char* env[]{
- "SUDO_UID", "PKEXEC_UID", "PACKAGEKIT_CALLER_UID", nullptr
- };
+ const char* EnvKeys[]{"SUDO_UID", "PKEXEC_UID", "PACKAGEKIT_CALLER_UID"};
- for (int i=0; env[i] != nullptr; i++)
+ for (const auto &Key: EnvKeys)
{
- if (getenv(env[i]) != nullptr)
+ if (getenv(Key) != nullptr)
{
- int uid = atoi(getenv(env[i]));
+ int uid = atoi(getenv(Key));
if (uid > 0) {
struct passwd pwd;
struct passwd *result;