[PATCH] [Sanitizer] Fix getpwnam test on ppc64le Fedora 21.

Jay Foad jay.foad at gmail.com
Thu Apr 23 14:30:34 PDT 2015


Hi eugenis,

On ppc64le Fedora 21, getpwnam_r("no-such-user", ...) returns ENOENT
instead of 0. Tolerate this in the test case.

http://reviews.llvm.org/D9233

Files:
  test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cc

Index: test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cc
===================================================================
--- test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cc
+++ test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cc
@@ -2,6 +2,7 @@
 // RUN: %clangxx -O0 -g %s -o %t && %run %t
 
 #include <assert.h>
+#include <errno.h>
 #include <pwd.h>
 #include <signal.h>
 #include <stdio.h>
@@ -13,7 +14,7 @@
   struct passwd *pwdres;
   char buf[10000];
   int res = getpwnam_r("no-such-user", &pwd, buf, sizeof(buf), &pwdres);
-  assert(res == 0);
+  assert(res == 0 || res == ENOENT);
   assert(pwdres == 0);
   return 0;
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9233.24334.patch
Type: text/x-patch
Size: 678 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150423/8dbdffff/attachment.bin>


More information about the llvm-commits mailing list