diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/klee-replay/file-creator.c | 15 | ||||
-rw-r--r-- | tools/ktest-gen/ktest-gen.cpp | 16 | ||||
-rw-r--r-- | tools/ktest-randgen/ktest-randgen.cpp | 5 |
3 files changed, 35 insertions, 1 deletions
diff --git a/tools/klee-replay/file-creator.c b/tools/klee-replay/file-creator.c index 497cf1c3..e103a39f 100644 --- a/tools/klee-replay/file-creator.c +++ b/tools/klee-replay/file-creator.c @@ -463,16 +463,31 @@ static void check_file(int index, exe_disk_file_t *dfile) { switch (index) { case __STDIN: strcpy(name, "stdin"); +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) + memset(&s, 0, sizeof(struct stat)); +#endif +#endif res = fstat(0, &s); break; case __STDOUT: strcpy(name, "stdout"); +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) + memset(&s, 0, sizeof(struct stat)); +#endif +#endif res = fstat(1, &s); break; default: name[0] = 'A' + index; name[1] = '\0'; snprintf(fullname, sizeof(fullname), "%s/%s", replay_dir, name); +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) + memset(&s, 0, sizeof(struct stat)); +#endif +#endif res = stat(fullname, &s); break; diff --git a/tools/ktest-gen/ktest-gen.cpp b/tools/ktest-gen/ktest-gen.cpp index a9f4be7c..331ff7b1 100644 --- a/tools/ktest-gen/ktest-gen.cpp +++ b/tools/ktest-gen/ktest-gen.cpp @@ -151,6 +151,11 @@ int main(int argc, char *argv[]) { current_file++) { char *content_filename = content_filenames_list[current_file]; +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) + memset(&file_stat[current_file], 0, sizeof(struct stat64)); +#endif +#endif if ((fp[current_file] = fopen(content_filename, "r")) == NULL || stat64(content_filename, file_stat + current_file) < 0) { perror("Failed to open"); @@ -218,7 +223,11 @@ int main(int argc, char *argv[]) { struct stat64 file_stat; char filename[6] = "stdin"; char statname[11] = "stdin-stat"; - +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) + memset(&file_stat, 0, sizeof(struct stat64)); +#endif +#endif if ((fp = fopen(stdin_content_filename, "r")) == NULL || stat64(stdin_content_filename, &file_stat) < 0) { fprintf(stderr, "Failure opening %s\n", stdin_content_filename); @@ -258,6 +267,11 @@ int main(int argc, char *argv[]) { char filename[7] = "stdout"; char statname[12] = "stdout-stat"; +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) + memset(&file_stat, 0, sizeof(struct stat64)); +#endif +#endif if ((fp = fopen(stdout_content_filename, "r")) == NULL || stat64(stdout_content_filename, &file_stat) < 0) { fprintf(stderr, "Failure opening %s\n", stdout_content_filename); diff --git a/tools/ktest-randgen/ktest-randgen.cpp b/tools/ktest-randgen/ktest-randgen.cpp index 04cf53e6..9b7260eb 100644 --- a/tools/ktest-randgen/ktest-randgen.cpp +++ b/tools/ktest-randgen/ktest-randgen.cpp @@ -117,6 +117,11 @@ void create_stat(size_t size, struct stat *s) { free(filename); error_exit("%s:%d: Error writing %s\n", __FILE__, __LINE__, filename); } +#if defined(__has_feature) +#if __has_feature(memory_sanitizer) + memset(s, 0, sizeof(struct stat)); +#endif +#endif fstat(fd, s); |