Fixed tests to use the right path when run as root

This commit is contained in:
Erik van der Kouwe
2009-12-04 17:51:06 +00:00
parent 09939b454e
commit 91d13ae054
7 changed files with 24 additions and 9 deletions
+3 -1
View File
@@ -44,11 +44,13 @@ int argc;
char *argv[];
{
char buffer[PATH_MAX + 1];
int i, m = 0xFFFF;
sync();
if (geteuid() == 0 || getuid() == 0) {
execl("/usr/bin/su", "/usr/bin/su", "-", "ast", "-c", "/usr/src/test/test21", NULL);
realpath(argv[0], buffer);
execl("/usr/bin/su", "/usr/bin/su", "-", "ast", "-c", buffer, NULL);
printf("Test 21 cannot run as root; test aborted\n");
exit(1);
}