diff options
Diffstat (limited to 'executor')
| -rw-r--r-- | executor/common_linux.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h index f1d4239a4..f887551cc 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -921,15 +921,14 @@ retry: static int inject_fault(int nth) { int fd; - char buf[128]; + char buf[16]; - sprintf(buf, "/proc/self/task/%d/fail-nth", (int)syscall(SYS_gettid)); - fd = open(buf, O_RDWR); + fd = open("/proc/thread-self/fail-nth", O_RDWR); if (fd == -1) - fail("failed to open /proc/self/task/tid/fail-nth"); + fail("failed to open /proc/thread-self/fail-nth"); sprintf(buf, "%d", nth + 1); if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) - fail("failed to write /proc/self/task/tid/fail-nth"); + fail("failed to write /proc/thread-self/fail-nth"); return fd; } #endif @@ -940,11 +939,11 @@ static int fault_injected(int fail_fd) char buf[16]; int n = read(fail_fd, buf, sizeof(buf) - 1); if (n <= 0) - fail("failed to read /proc/self/task/tid/fail-nth"); + fail("failed to read /proc/thread-self/fail-nth"); int res = n == 2 && buf[0] == '0' && buf[1] == '\n'; buf[0] = '0'; if (write(fail_fd, buf, 1) != 1) - fail("failed to write /proc/self/task/tid/fail-nth"); + fail("failed to write /proc/thread-self/fail-nth"); close(fail_fd); return res; } |
