slurp: don't special-case empty files, instead behave like strdup("")

This allows the caller to call free(3) in any case.
pull/163/head
Leah Neukirchen 5 years ago
parent fd675ef159
commit 5b0755ca68

@ -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;

Loading…
Cancel
Save