From: Guido Vranken Date: Fri, 23 Jun 2017 13:50:55 +0000 (+0200) Subject: IO abstractions in buffer.c, buffer.h X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05ae1d5ce57ff5e92cd089e03525382cee26b637;p=thirdparty%2Fopenvpn.git IO abstractions in buffer.c, buffer.h --- diff --git a/src/openvpn/buffer.c b/src/openvpn/buffer.c index 87e27ec0a..72fcc8c6a 100644 --- a/src/openvpn/buffer.c +++ b/src/openvpn/buffer.c @@ -1095,7 +1095,7 @@ character_class_debug(void) { char buf[256]; - while (fgets(buf, sizeof(buf), stdin) != NULL) + while (platform_fgets(buf, sizeof(buf), stdin) != NULL) { string_mod(buf, CC_INCLUDE, CC_EXCLUDE, CC_REPLACE); printf("%s", buf); @@ -1323,13 +1323,13 @@ buffer_list_file(const char *fn, int max_line_len) if (line) { bl = buffer_list_new(0); - while (fgets(line, max_line_len, fp) != NULL) + while (platform_fgets(line, max_line_len, fp) != NULL) { buffer_list_push(bl, (unsigned char *)line); } free(line); } - fclose(fp); + platform_fclose(fp); } return bl; } diff --git a/src/openvpn/buffer.h b/src/openvpn/buffer.h index 8bc442873..cc12c2a9a 100644 --- a/src/openvpn/buffer.h +++ b/src/openvpn/buffer.h @@ -26,6 +26,7 @@ #include "basic.h" #include "error.h" +#include "platform.h" #define BUF_SIZE_MAX 1000000 @@ -203,7 +204,7 @@ bool buf_init_debug(struct buffer *buf, int offset, const char *file, int line); inline static void gc_freeaddrinfo_callback(void *addr) { - freeaddrinfo((struct addrinfo *) addr); + platform_freeaddrinfo((struct addrinfo *) addr); } static inline bool