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
@@ -119,11 +119,13 @@ int main(argc, argv)
int argc;
char *argv[];
{
char buffer[PATH_MAX + 1];
int n, mask;
sync();
if (geteuid() == 0 || getuid() == 0) {
execl("/usr/bin/su", "/usr/bin/su", "-", "ast", "-c", "/usr/src/test/test17", NULL);
realpath(argv[0], buffer);
execl("/usr/bin/su", "/usr/bin/su", "-", "ast", "-c", buffer, NULL);
printf("Test 17 cannot run as root; test aborted\n");
exit(1);
}