dyninst/dyninst-test2_4-kill-init.patch
Josh Stone 4d44e8495d Add a dyninst-testsuite package.
- Patch test2_4 to protect against running as root.
- Make dyninst-static require dyninst-devel.
2013-02-25 14:47:18 -08:00

26 lines
875 B
Diff

commit 3a6a6d980d345552ebb6c2dd27b874dbb9794e7d
Author: Andrew Bernat <bernat@cs.wisc.edu>
Date: Thu Feb 21 13:14:29 2013 -0600
Fix a system crash when running the test suite as root
diff --git a/testsuite/src/dyninst/test2_4.C b/testsuite/src/dyninst/test2_4.C
index 2920149..1cbb6a6 100644
--- a/testsuite/src/dyninst/test2_4.C
+++ b/testsuite/src/dyninst/test2_4.C
@@ -68,6 +68,14 @@ extern "C" DLLEXPORT TestMutator *test2_4_factory() {
// static int mutatorTest(BPatch *bpatch, bool useAttach)
test_results_t test2_4_Mutator::executeTest() {
// attach to an a protected pid
+
+#if !defined(os_windows_test)
+ if (getuid() == 0 || geteuid() == 0) {
+ // We're root, there _are_ no protected PIDs
+ return SKIPPED;
+ }
+#endif
+
clearError();
BPatch_process *ret = bpatch->processAttach(NULL, 1);
int gotError = getError();