diff options
Diffstat (limited to 'compiler-rt/lib/profile/GCDAProfiling.c')
| -rw-r--r-- | compiler-rt/lib/profile/GCDAProfiling.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c index ea62e794a51..f80e062485e 100644 --- a/compiler-rt/lib/profile/GCDAProfiling.c +++ b/compiler-rt/lib/profile/GCDAProfiling.c @@ -206,6 +206,11 @@ static int map_file() { fseek(output_file, 0L, SEEK_END); file_size = ftell(output_file); + /* A size of 0 is invaild to `mmap'. Return a fail here, but don't issue an + * error message because it should "just work" for the user. */ + if (file_size == 0) + return -1; + write_buffer = mmap(0, file_size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0); if (write_buffer == (void *)-1) { |

