Fill uid/gid for screenshots at compile time
It's not necessary to rely on the success of a call to getpwnam() for
the uid/gid of a file stored to sdcard (or external storage). Use the
definitions in system/core/include/private/android_filesystem_config.h
Change-Id: I979cfa0c74ecc927b88b0967cc56a66da237cc60
diff --git a/gui/action.cpp b/gui/action.cpp
index fef4762..9c8af35 100644
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -32,7 +32,7 @@
#include <stdlib.h>
#include <sys/wait.h>
#include <dirent.h>
-#include <pwd.h>
+#include <private/android_filesystem_config.h>
#include <string>
#include <sstream>
@@ -938,14 +938,8 @@
time_t tm;
char path[256];
int path_len;
- uid_t uid = -1;
- gid_t gid = -1;
-
- struct passwd *pwd = getpwnam("media_rw");
- if (pwd) {
- uid = pwd->pw_uid;
- gid = pwd->pw_gid;
- }
+ uid_t uid = AID_MEDIA_RW;
+ gid_t gid = AID_MEDIA_RW;
const std::string storage = DataManager::GetCurrentStoragePath();
if (PartitionManager.Is_Mounted_By_Path(storage)) {