[PATCH] [Msan] Fix the getgrnam_r unit test to pass on FreeBSD
Viktor Kutuzov
vkutuzov at accesssoftek.com
Mon Feb 2 05:22:08 PST 2015
Hi kcc, samsonov, eugenis,
http://reviews.llvm.org/D7339
Files:
lib/msan/tests/msan_test.cc
Index: lib/msan/tests/msan_test.cc
===================================================================
--- lib/msan/tests/msan_test.cc
+++ lib/msan/tests/msan_test.cc
@@ -95,11 +95,13 @@
# define DIR_TO_READ "/bin"
# define SUBFILE_TO_READ "cat"
# define SYMLINK_TO_READ "/usr/bin/tar"
+# define SUPERUSER_GROUP "wheel"
#else
# define FILE_TO_READ "/proc/self/stat"
# define DIR_TO_READ "/proc/self"
# define SUBFILE_TO_READ "stat"
# define SYMLINK_TO_READ "/proc/self/exe"
+# define SUPERUSER_GROUP "root"
#endif
static const size_t kPageSize = 4096;
@@ -3269,8 +3271,10 @@
struct group grp;
struct group *grpres;
char buf[10000];
- int res = getgrnam_r("root", &grp, buf, sizeof(buf), &grpres);
+ int res = getgrnam_r(SUPERUSER_GROUP, &grp, buf, sizeof(buf), &grpres);
ASSERT_EQ(0, res);
+ // Note that getgrnam_r() returns 0 if the matching group is not found.
+ ASSERT_NE(nullptr, grpres);
EXPECT_NOT_POISONED(grp.gr_name);
ASSERT_TRUE(grp.gr_name != NULL);
EXPECT_NOT_POISONED(grp.gr_name[0]);
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7339.19145.patch
Type: text/x-patch
Size: 1036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150202/360d3f3e/attachment.bin>
More information about the llvm-commits
mailing list