diff --git a/cgi.c b/cgi.c index 554ad6d..6be0398 100644 --- a/cgi.c +++ b/cgi.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #define MAX_ENV_SIZE 100 @@ -58,54 +59,6 @@ void destroy() freedict(cgi_bin); } -static int guard_read(int fd, void *buffer, size_t size) -{ - int n = 0; - int read_len; - int st; - while (n != (int)size) - { - read_len = (int)size - n; - st = read(fd, buffer + n, read_len); - if (st == -1) - { - ERROR("Unable to read from #%d: %s", fd, strerror(errno)); - return -1; - } - if (st == 0) - { - ERROR("Endpoint %d is closed", fd); - return -1; - } - n += st; - } - return n; -} - -static int guard_write(int fd, void *buffer, size_t size) -{ - int n = 0; - int write_len; - int st; - while (n != (int)size) - { - write_len = (int)size - n; - st = write(fd, buffer + n, write_len); - if (st == -1) - { - ERROR("Unable to write to #%d: %s", fd, strerror(errno)); - return -1; - } - if (st == 0) - { - ERROR("Endpoint %d is closed", fd); - return -1; - } - n += st; - } - return n; -} - static void add_vars(envar_arr_t *l, char *k, char *v) { if (!v || !l || !k) diff --git a/dist/cgi-1.0.0b.tar.gz b/dist/cgi-1.0.0b.tar.gz index 0910b22..69f57ce 100644 Binary files a/dist/cgi-1.0.0b.tar.gz and b/dist/cgi-1.0.0b.tar.gz differ