diff options
Diffstat (limited to 'src/libmdsserver/util.h')
-rw-r--r-- | src/libmdsserver/util.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libmdsserver/util.h b/src/libmdsserver/util.h index 3de6f02..da2cb9f 100644 --- a/src/libmdsserver/util.h +++ b/src/libmdsserver/util.h @@ -74,6 +74,24 @@ size_t send_message(int socket, const char* message, size_t length); */ int strict_atoi(const char* str, int* value, int min, int max); +/** + * Send a buffer into a file and ignore interruptions + * + * @param fd The file descriptor + * @param buffer The buffer + * @param length The length of the buffer + * @return Zero on success, -1 on error + */ +int full_write(int fd, const char* buffer, size_t length); + +/** + * Read a file completly and ignore interruptions + * + * @param fd The file descriptor + * @return The content of the file, you will need to free it. `NULL` on error. + */ +char* full_read(int fd); + #endif |