[PATCH] D32800: [msan] Fix getmntent{_r} for empty /etc/fstab

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 4 10:30:20 PDT 2017


zatrazz added inline comments.


================
Comment at: lib/msan/tests/msan_test.cc:2213
+
+   void Create(void) {
+     snprintf(tmpfile, sizeof(tmpfile), "/tmp/msan.getmntent.tmp.XXXXXX");
----------------
eugenis wrote:
> Either make this a constructor, or call it from the constructor, or  add a check in the destructor so that it does not try to unlink an uninitialized path if Create was never called.
> 
> What happens if the test fails in one of the ASSERTs, will the file be unlinked? We build msan tests with -fno-exceptions.
We can't really add the EXPECT_* macros on constructor, so I changed to a different logic: the Create returns a bool and set an internal file descriptor indicating the file was open correctly. The destructor close the file assuring the removal since it was unlinked after successful opening. 


https://reviews.llvm.org/D32800





More information about the llvm-commits mailing list