diff options
-rw-r--r-- | extract-gcov.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extract-gcov.c b/extract-gcov.c index 75c1108..c9b82f3 100644 --- a/extract-gcov.c +++ b/extract-gcov.c @@ -128,6 +128,11 @@ static void write_gcda(char *addr, struct gcov_info* gi) printf("Writing %s\n", filename); fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); + if (fd < 0) { + fprintf(stderr, "Error opening file %s: %d %s\n", + filename, errno, strerror(errno)); + exit(EXIT_FAILURE); + } write_u32(fd, GCOV_DATA_MAGIC); write_u32(fd, be32toh(gi->version)); write_u32(fd, be32toh(gi->stamp)); |