X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/46e88ba252230858abe891d5815fce884d3cf35d..607bab3fe856d228f22e1cd96dbb7204e2f3375d:/apt-pkg/deb/dpkgpm.cc?ds=sidebyside diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 6751e9779..1afcb6527 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -49,6 +49,7 @@ #include #include #include +#include #include /*}}}*/ @@ -58,15 +59,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;