Skip to content

Commit

Permalink
Merge pull request #212 from eriksjolund/restore-errno-after-successf…
Browse files Browse the repository at this point in the history
…ul-fclose

read-file.c: restore errno after successful fclose()
  • Loading branch information
alexlarsson authored Oct 9, 2023
2 parents 4751481 + 0e0a644 commit ce6abac
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/read-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ char *read_file(const char *path, size_t *length)
if (buf) {
save_errno = errno;
free(buf);
buf = NULL;
}
errno = save_errno;
return NULL;
}

errno = save_errno;
return buf;
}

0 comments on commit ce6abac

Please sign in to comment.