[libc-commits] [libc] [libc] Add getpwnam_r and getpwuid_r entrypoints (PR #220833)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Thu Sep 3 08:49:35 PDT 2026


================
@@ -45,24 +45,32 @@ class HermeticFile {
       f->write(content, len);
       f->close();
     }
+    LIBC_NAMESPACE::passwd::TESTONLY_set_passwd_path(path);
   }
 
-  ~HermeticFile() { LIBC_NAMESPACE::remove(path); }
+  ~ScopedPasswdFile() {
+    LIBC_NAMESPACE::passwd::TESTONLY_reset_passwd_path();
+    LIBC_NAMESPACE::remove(path);
+  }
 
   const char *get_path() const { return path; }
 };
 
-class LlvmLibcPwdTest : public LIBC_NAMESPACE::testing::ErrnoCheckingTest {};
+class LlvmLibcPwdTest : public LIBC_NAMESPACE::testing::ErrnoCheckingTest {
+protected:
+  void TearDown() override {
+    LIBC_NAMESPACE::passwd::TESTONLY_reset_passwd_path();
+  }
----------------
vonosmas wrote:

Do you need to call parent class TearDown() here?

https://github.com/llvm/llvm-project/pull/220833


More information about the libc-commits mailing list