about summary refs log tree commit diff
path: root/slurp.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2019-04-23 12:34:32 +0200
committerLeah Neukirchen <leah@vuxu.org>2019-04-23 12:34:32 +0200
commit5b0755ca685e2b1079ecd3fc7a2df78d1ac197c9 (patch)
treebca6f9e545f15b0375020f20d846741cecf52774 /slurp.c
parentfd675ef159748a2d69071a36fcef9a4155be9eeb (diff)
downloadmblaze-5b0755ca685e2b1079ecd3fc7a2df78d1ac197c9.tar.gz
mblaze-5b0755ca685e2b1079ecd3fc7a2df78d1ac197c9.tar.xz
mblaze-5b0755ca685e2b1079ecd3fc7a2df78d1ac197c9.zip
slurp: don't special-case empty files, instead behave like strdup("")
This allows the caller to call free(3) in any case.
Diffstat (limited to 'slurp.c')
-rw-r--r--slurp.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/slurp.c b/slurp.c
index fff8624..7dbf5ed 100644
--- a/slurp.c
+++ b/slurp.c
@@ -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;