diff --git a/tests/tst-strerror_r.cc b/tests/tst-strerror_r.cc
index 425729ba78290e4c5b996c153f402be131115d13..131515775625540449779b003ddae63eac298826 100644
--- a/tests/tst-strerror_r.cc
+++ b/tests/tst-strerror_r.cc
@@ -26,8 +26,9 @@ void report(bool ok, string msg)
 
 int main(int ac, char** av)
 {
-    error_code ec(EPERM, system_category());
-    report(ec.message().substr(7) != "unknown", "strerror_r() called from a _GNU_SOURCE binary");
+    error_code ec(EACCES, system_category());
+    auto ok = ec.message() == "Permission denied";
+    report(ok, "strerror_r() called from a _GNU_SOURCE binary");
     std::cout << "Test complete (" << failures << "/" << tests << " failures)\n";
     return failures ? 1 : 0;
 }