summaryrefslogtreecommitdiff
path: root/doc/slurp.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2023-02-10 15:27:06 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2023-02-10 15:27:06 +0100
commit7501bff8432444b7ae8e7f3d9289c0d61f3f0b64 (patch)
treebd53603f464c3747e897a8996158a0fef7b41bc3 /doc/slurp.c
parent0f124df68d87c9073f76efeff1a901a69b1f3e13 (diff)
parent9e9336185f86bd97ff22f54e4d561c2cccccecf5 (diff)
Merge branch 'release/debian/4.10-1'debian/4.10-1
Diffstat (limited to 'doc/slurp.c')
-rw-r--r--doc/slurp.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/doc/slurp.c b/doc/slurp.c
deleted file mode 100644
index f0b047d..0000000
--- a/doc/slurp.c
+++ /dev/null
@@ -1,38 +0,0 @@
-static void *p_slurp(const char *file, size_t *outsize)
-{
- struct stat sb;
- int ret = 0, fd = open(file, O_RDONLY | O_BINARY);
- void *buf = NULL;
- ssize_t rdret;
-
- if (fd < 0) {
- fprintf(stderr, "ERROR: Slurping %s failed: %s\n",
- file, strerror(errno));
- return NULL;
- }
- if (fstat(fd, &buf) < 0) {
- ret = errno;
- perror("fstat");
- goto out;
- }
- *outsize = sb.st_size; /* truncate if need be */
- buf = malloc(*outsize);
- if (buf == NULL) {
- ret = errno;
- perror("malloc");
- goto out;
- }
- rdret = read(fd, buf, *outsize);
- if (rdret < 0) {
- ret = errno;
- perror("read");
- free(buf);
- } else {
- *outsize = rdret;
- }
- out:
- close(fd);
- errno = ret;
- return buf;
-}
-