Skip to content

Commit

Permalink
slurp: don't special-case empty files, instead behave like strdup("")
Browse files Browse the repository at this point in the history
This allows the caller to call free(3) in any case.
  • Loading branch information
leahneukirchen committed Apr 23, 2019
1 parent fd675ef commit 5b0755c
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions slurp.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ slurp(char *filename, char **bufo, off_t *leno)
r = errno;
goto out;
}
if (st.st_size == 0) {
*bufo = "";
*leno = 0;
return 0;
}
*bufo = malloc(st.st_size + 1);
if (!*bufo) {
r = ENOMEM;
Expand Down

0 comments on commit 5b0755c

Please sign in to comment.