Loading src/main.c +5 −3 Original line number Diff line number Diff line Loading @@ -1319,11 +1319,11 @@ static int str2offset(curl_off_t *val, char *str) /* this is a duplicate of the function that is also used in libcurl */ *val = curlx_strtoofft(str, NULL, 0); if ((*val == LLONG_MAX || *val == LLONG_MIN) && errno == ERANGE) if ((*val == LLONG_MAX || *val == LLONG_MIN) && ERRNO == ERANGE) return 1; #else *val = strtol(str, NULL, 0); if ((*val == LONG_MIN || *val == LONG_MAX) && errno == ERANGE) if ((*val == LONG_MIN || *val == LONG_MAX) && ERRNO == ERANGE) return 1; #endif return 0; Loading Loading @@ -4621,6 +4621,7 @@ static int create_dir_hierarchy(char *outfile) char *outdup; char *dirbuildup; int result=0; int error; outdup = strdup(outfile); dirbuildup = malloc(sizeof(char) * strlen(outfile)); Loading @@ -4646,7 +4647,8 @@ static int create_dir_hierarchy(char *outfile) if (access(dirbuildup, F_OK) == -1) { result = mkdir(dirbuildup,(mode_t)0000750); if (-1 == result) { switch (errno) { error = ERRNO; switch (error) { #ifdef EACCES case EACCES: fprintf(stderr,"You don't have permission to create %s.\n", Loading tests/libtest/lib518.c +6 −20 Original line number Diff line number Diff line Loading @@ -46,20 +46,6 @@ static int *fd = NULL; static struct rlimit num_open; static char msgbuff[256]; /* * our_errno() returns the NOT *socket-related* errno (or equivalent) * on this platform to hide platform specific for the calling function. */ static int our_errno(void) { #ifdef WIN32 return (int)GetLastError(); #else return errno; #endif } static void store_errmsg(const char *msg, int err) { if (!err) Loading Loading @@ -102,7 +88,7 @@ static int rlimit(int keep_open) /* get initial open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", our_errno()); store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -1; } Loading Loading @@ -145,7 +131,7 @@ static int rlimit(int keep_open) fprintf(stderr, "raising soft limit up to hard limit\n"); rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("setrlimit() failed", our_errno()); store_errmsg("setrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -2; } Loading @@ -153,7 +139,7 @@ static int rlimit(int keep_open) /* get current open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", our_errno()); store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -3; } Loading Loading @@ -233,7 +219,7 @@ static int rlimit(int keep_open) } } while (nitems && !memchunk); if (!memchunk) { store_errmsg("memchunk, malloc() failed", our_errno()); store_errmsg("memchunk, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -5; } Loading Loading @@ -268,7 +254,7 @@ static int rlimit(int keep_open) fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max)); if (!fd) { store_errmsg("fd, malloc() failed", our_errno()); store_errmsg("fd, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); free(memchunk); return -7; Loading @@ -291,7 +277,7 @@ static int rlimit(int keep_open) fd[0] = open(DEV_NULL, O_RDONLY); if (fd[0] < 0) { sprintf(strbuff, "opening of %s failed", DEV_NULL); store_errmsg(strbuff, our_errno()); store_errmsg(strbuff, ERRNO); fprintf(stderr, "%s\n", msgbuff); free(fd); fd = NULL; Loading tests/libtest/lib537.c +6 −20 Original line number Diff line number Diff line Loading @@ -48,20 +48,6 @@ static int *fd = NULL; static struct rlimit num_open; static char msgbuff[256]; /* * our_errno() returns the NOT *socket-related* errno (or equivalent) * on this platform to hide platform specific for the calling function. */ static int our_errno(void) { #ifdef WIN32 return (int)GetLastError(); #else return errno; #endif } static void store_errmsg(const char *msg, int err) { if (!err) Loading Loading @@ -104,7 +90,7 @@ static int rlimit(int keep_open) /* get initial open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", our_errno()); store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -1; } Loading Loading @@ -141,7 +127,7 @@ static int rlimit(int keep_open) fprintf(stderr, "raising soft limit up to hard limit\n"); rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("setrlimit() failed", our_errno()); store_errmsg("setrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -2; } Loading @@ -149,7 +135,7 @@ static int rlimit(int keep_open) /* get current open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", our_errno()); store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -3; } Loading Loading @@ -208,7 +194,7 @@ static int rlimit(int keep_open) } } while (nitems && !memchunk); if (!memchunk) { store_errmsg("memchunk, malloc() failed", our_errno()); store_errmsg("memchunk, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -4; } Loading Loading @@ -263,7 +249,7 @@ static int rlimit(int keep_open) } } while (num_open.rlim_max && !fd); if (!fd) { store_errmsg("fd, malloc() failed", our_errno()); store_errmsg("fd, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); free(memchunk); return -6; Loading @@ -286,7 +272,7 @@ static int rlimit(int keep_open) fd[0] = open(DEV_NULL, O_RDONLY); if (fd[0] < 0) { sprintf(strbuff, "opening of %s failed", DEV_NULL); store_errmsg(strbuff, our_errno()); store_errmsg(strbuff, ERRNO); fprintf(stderr, "%s\n", msgbuff); free(fd); fd = NULL; Loading tests/libtest/test.h +1 −2 Original line number Diff line number Diff line Loading @@ -8,18 +8,17 @@ * $Id$ */ #ifdef HAVE_CONFIG_H /* Now include the setup.h file from libcurl's private libdir (the source version, but that might include "config.h" from the build dir so we need both of them in the include path), so that we get good in-depth knowledge about the system we're building this on */ #include "setup.h" #endif #include <curl.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> Loading tests/server/sockfilt.c +3 −3 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ static int juggle(curl_socket_t *sockfdp, do { rc = select(maxfd + 1, &fds_read, &fds_write, &fds_err, &timeout); } while((rc == -1) && (our_sockerrno() == EINTR)); } while((rc == -1) && (SOCKERRNO == EINTR)); switch(rc) { case -1: Loading Loading @@ -447,7 +447,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, /* start accepting connections */ rc = listen(sock, 4); if(0 != rc) { logmsg("listen() failed with error: %d", errno); logmsg("listen() failed with error: %d", SOCKERRNO); sclose(sock); return CURL_SOCKET_BAD; } Loading Loading @@ -570,7 +570,7 @@ int main(int argc, char *argv[]) sock = mksock(use_ipv6); if (CURL_SOCKET_BAD == sock) { logmsg("Error opening socket: %d", errno); logmsg("Error opening socket: %d", SOCKERRNO); return 1; } Loading Loading
src/main.c +5 −3 Original line number Diff line number Diff line Loading @@ -1319,11 +1319,11 @@ static int str2offset(curl_off_t *val, char *str) /* this is a duplicate of the function that is also used in libcurl */ *val = curlx_strtoofft(str, NULL, 0); if ((*val == LLONG_MAX || *val == LLONG_MIN) && errno == ERANGE) if ((*val == LLONG_MAX || *val == LLONG_MIN) && ERRNO == ERANGE) return 1; #else *val = strtol(str, NULL, 0); if ((*val == LONG_MIN || *val == LONG_MAX) && errno == ERANGE) if ((*val == LONG_MIN || *val == LONG_MAX) && ERRNO == ERANGE) return 1; #endif return 0; Loading Loading @@ -4621,6 +4621,7 @@ static int create_dir_hierarchy(char *outfile) char *outdup; char *dirbuildup; int result=0; int error; outdup = strdup(outfile); dirbuildup = malloc(sizeof(char) * strlen(outfile)); Loading @@ -4646,7 +4647,8 @@ static int create_dir_hierarchy(char *outfile) if (access(dirbuildup, F_OK) == -1) { result = mkdir(dirbuildup,(mode_t)0000750); if (-1 == result) { switch (errno) { error = ERRNO; switch (error) { #ifdef EACCES case EACCES: fprintf(stderr,"You don't have permission to create %s.\n", Loading
tests/libtest/lib518.c +6 −20 Original line number Diff line number Diff line Loading @@ -46,20 +46,6 @@ static int *fd = NULL; static struct rlimit num_open; static char msgbuff[256]; /* * our_errno() returns the NOT *socket-related* errno (or equivalent) * on this platform to hide platform specific for the calling function. */ static int our_errno(void) { #ifdef WIN32 return (int)GetLastError(); #else return errno; #endif } static void store_errmsg(const char *msg, int err) { if (!err) Loading Loading @@ -102,7 +88,7 @@ static int rlimit(int keep_open) /* get initial open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", our_errno()); store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -1; } Loading Loading @@ -145,7 +131,7 @@ static int rlimit(int keep_open) fprintf(stderr, "raising soft limit up to hard limit\n"); rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("setrlimit() failed", our_errno()); store_errmsg("setrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -2; } Loading @@ -153,7 +139,7 @@ static int rlimit(int keep_open) /* get current open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", our_errno()); store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -3; } Loading Loading @@ -233,7 +219,7 @@ static int rlimit(int keep_open) } } while (nitems && !memchunk); if (!memchunk) { store_errmsg("memchunk, malloc() failed", our_errno()); store_errmsg("memchunk, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -5; } Loading Loading @@ -268,7 +254,7 @@ static int rlimit(int keep_open) fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max)); if (!fd) { store_errmsg("fd, malloc() failed", our_errno()); store_errmsg("fd, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); free(memchunk); return -7; Loading @@ -291,7 +277,7 @@ static int rlimit(int keep_open) fd[0] = open(DEV_NULL, O_RDONLY); if (fd[0] < 0) { sprintf(strbuff, "opening of %s failed", DEV_NULL); store_errmsg(strbuff, our_errno()); store_errmsg(strbuff, ERRNO); fprintf(stderr, "%s\n", msgbuff); free(fd); fd = NULL; Loading
tests/libtest/lib537.c +6 −20 Original line number Diff line number Diff line Loading @@ -48,20 +48,6 @@ static int *fd = NULL; static struct rlimit num_open; static char msgbuff[256]; /* * our_errno() returns the NOT *socket-related* errno (or equivalent) * on this platform to hide platform specific for the calling function. */ static int our_errno(void) { #ifdef WIN32 return (int)GetLastError(); #else return errno; #endif } static void store_errmsg(const char *msg, int err) { if (!err) Loading Loading @@ -104,7 +90,7 @@ static int rlimit(int keep_open) /* get initial open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", our_errno()); store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -1; } Loading Loading @@ -141,7 +127,7 @@ static int rlimit(int keep_open) fprintf(stderr, "raising soft limit up to hard limit\n"); rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("setrlimit() failed", our_errno()); store_errmsg("setrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -2; } Loading @@ -149,7 +135,7 @@ static int rlimit(int keep_open) /* get current open file limits */ if (getrlimit(RLIMIT_NOFILE, &rl) != 0) { store_errmsg("getrlimit() failed", our_errno()); store_errmsg("getrlimit() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -3; } Loading Loading @@ -208,7 +194,7 @@ static int rlimit(int keep_open) } } while (nitems && !memchunk); if (!memchunk) { store_errmsg("memchunk, malloc() failed", our_errno()); store_errmsg("memchunk, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); return -4; } Loading Loading @@ -263,7 +249,7 @@ static int rlimit(int keep_open) } } while (num_open.rlim_max && !fd); if (!fd) { store_errmsg("fd, malloc() failed", our_errno()); store_errmsg("fd, malloc() failed", ERRNO); fprintf(stderr, "%s\n", msgbuff); free(memchunk); return -6; Loading @@ -286,7 +272,7 @@ static int rlimit(int keep_open) fd[0] = open(DEV_NULL, O_RDONLY); if (fd[0] < 0) { sprintf(strbuff, "opening of %s failed", DEV_NULL); store_errmsg(strbuff, our_errno()); store_errmsg(strbuff, ERRNO); fprintf(stderr, "%s\n", msgbuff); free(fd); fd = NULL; Loading
tests/libtest/test.h +1 −2 Original line number Diff line number Diff line Loading @@ -8,18 +8,17 @@ * $Id$ */ #ifdef HAVE_CONFIG_H /* Now include the setup.h file from libcurl's private libdir (the source version, but that might include "config.h" from the build dir so we need both of them in the include path), so that we get good in-depth knowledge about the system we're building this on */ #include "setup.h" #endif #include <curl.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <errno.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> Loading
tests/server/sockfilt.c +3 −3 Original line number Diff line number Diff line Loading @@ -238,7 +238,7 @@ static int juggle(curl_socket_t *sockfdp, do { rc = select(maxfd + 1, &fds_read, &fds_write, &fds_err, &timeout); } while((rc == -1) && (our_sockerrno() == EINTR)); } while((rc == -1) && (SOCKERRNO == EINTR)); switch(rc) { case -1: Loading Loading @@ -447,7 +447,7 @@ static curl_socket_t sockdaemon(curl_socket_t sock, /* start accepting connections */ rc = listen(sock, 4); if(0 != rc) { logmsg("listen() failed with error: %d", errno); logmsg("listen() failed with error: %d", SOCKERRNO); sclose(sock); return CURL_SOCKET_BAD; } Loading Loading @@ -570,7 +570,7 @@ int main(int argc, char *argv[]) sock = mksock(use_ipv6); if (CURL_SOCKET_BAD == sock) { logmsg("Error opening socket: %d", errno); logmsg("Error opening socket: %d", SOCKERRNO); return 1; } Loading