Add ability to read /etc/passwd and /etc/group
Add the capability to read /etc/passwd and /etc/group for getpw* and
getgr* functions.
Bug: 27999086
Test: pwd, grp, grp_pwd_file unit tests
Test: Read in custom users/groups from /etc/{passwd,group}
Change-Id: Idc1f054af8a7ca34743a90493495f0ccc775a0d8
diff --git a/libc/private/bionic_lock.h b/libc/private/bionic_lock.h
index b389247..54168d3 100644
--- a/libc/private/bionic_lock.h
+++ b/libc/private/bionic_lock.h
@@ -76,4 +76,19 @@
}
};
+class LockGuard {
+ public:
+ LockGuard(Lock& lock) : lock_(lock) {
+ lock_.lock();
+ }
+ ~LockGuard() {
+ lock_.unlock();
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(LockGuard);
+
+ private:
+ Lock& lock_;
+};
+
#endif // _BIONIC_LOCK_H