build+tests: Correct detection of privilege elevation/drop and the corresponding test case

Change-Id: I005c2846474a00aeeb3e63a1e9761a3f8bc0a572
Refs: #3494, #3632, #3633
diff --git a/wscript b/wscript
index 5d1b35d..d169a5a 100644
--- a/wscript
+++ b/wscript
@@ -85,11 +85,14 @@
 int
 main(int, char**)
 {
+  char buffer[100];
   ::sysconf(_SC_GETGR_R_SIZE_MAX);
   group grp;
-  getgrnam_r("nogroup", &grp, nullptr, 0, nullptr);
+  group* grpRes;
+  getgrnam_r("nogroup", &grp, buffer, 100, &grpRes);
   passwd pwd;
-  getpwnam_r("nobody", &pwd, nullptr, 0, nullptr);
+  passwd* pwdRes;
+  getpwnam_r("nobody", &pwd, buffer, 100, &pwdRes);
 
   int ret = setegid(grp.gr_gid);
   ret = seteuid(pwd.pw_uid);