diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-11-25 12:42:36 +0100 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2020-12-02 20:39:36 +0100 |
commit | f7a89529330044f4e2a38e85a88ec90f839ae64e (patch) | |
tree | 23b187477ea294d9a0f7d0557c3a51acdd0cbdd0 /XUtils.h | |
parent | 1d8192c10b4e149c7f9126f00534f6a8488d10c4 (diff) |
Add xReadfile wrapper for reading small to medium size files
Inspired by proposed Linux syscall
Avoid file descriptor leaks like 4af8c63f
Diffstat (limited to 'XUtils.h')
-rw-r--r-- | XUtils.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -14,6 +14,7 @@ in the source distribution for its full text. #include <stdlib.h> // IWYU pragma: keep #include <string.h> // IWYU pragma: keep +#include "Compat.h" #include "Macros.h" @@ -63,4 +64,7 @@ char* xStrdup(const char* str) ATTR_NONNULL; char* xStrndup(const char* str, size_t len) ATTR_NONNULL; +ssize_t xReadfile(const char* pathname, void* buffer, size_t count); +ssize_t xReadfileat(openat_arg_t dirfd, const char* pathname, void* buffer, size_t count); + #endif |