1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

tests: Fix up issues with errno in test files

Closes https://github.com/curl/curl/pull/1671
This commit is contained in:
Max Dymond 2017-07-10 13:50:15 +01:00 committed by Marcel Raad
parent a5834e525d
commit e909de65b9
No known key found for this signature in database
GPG Key ID: 07ADACB610D796DA
7 changed files with 25 additions and 25 deletions

View File

@ -55,7 +55,7 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) {
error = ERRNO;
error = errno;
fprintf(stderr, "fopen failed with error: %d %s\n",
error, strerror(error));
fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
@ -66,7 +66,7 @@ int test(char *URL)
hd = fstat(fileno(hd_src), &file_info);
if(hd == -1) {
/* can't open file, bail out */
error = ERRNO;
error = errno;
fprintf(stderr, "fstat() failed with error: %d %s\n",
error, strerror(error));
fprintf(stderr, "ERROR: cannot open file %s\n", libtest_arg2);

View File

@ -86,7 +86,7 @@ static int fopen_works(void)
for(i = 0; i < 3; i++) {
fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
if(fpa[i] == NULL) {
store_errmsg("fopen failed", ERRNO);
store_errmsg("fopen failed", errno);
fprintf(stderr, "%s\n", msgbuff);
ret = 0;
break;
@ -122,7 +122,7 @@ static int rlimit(int keep_open)
/* get initial open file limits */
if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
store_errmsg("getrlimit() failed", ERRNO);
store_errmsg("getrlimit() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
return -1;
}
@ -169,7 +169,7 @@ static int rlimit(int keep_open)
rl.rlim_cur = OPEN_MAX;
if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
/* on failure don't abort just issue a warning */
store_errmsg("setrlimit() failed", ERRNO);
store_errmsg("setrlimit() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
msgbuff[0] = '\0';
}
@ -180,7 +180,7 @@ static int rlimit(int keep_open)
rl.rlim_cur = rl.rlim_max;
if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
/* on failure don't abort just issue a warning */
store_errmsg("setrlimit() failed", ERRNO);
store_errmsg("setrlimit() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
msgbuff[0] = '\0';
}
@ -188,7 +188,7 @@ static int rlimit(int keep_open)
/* get current open file limits */
if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
store_errmsg("getrlimit() failed", ERRNO);
store_errmsg("getrlimit() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
return -3;
}
@ -268,7 +268,7 @@ static int rlimit(int keep_open)
}
} while(nitems && !memchunk);
if(!memchunk) {
store_errmsg("memchunk, malloc() failed", ERRNO);
store_errmsg("memchunk, malloc() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
return -5;
}
@ -303,7 +303,7 @@ static int rlimit(int keep_open)
fd = malloc(sizeof(*fd) * (size_t)(num_open.rlim_max));
if(!fd) {
store_errmsg("fd, malloc() failed", ERRNO);
store_errmsg("fd, malloc() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
return -7;
@ -326,7 +326,7 @@ static int rlimit(int keep_open)
fd[0] = open(DEV_NULL, O_RDONLY);
if(fd[0] < 0) {
snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
store_errmsg(strbuff, ERRNO);
store_errmsg(strbuff, errno);
fprintf(stderr, "%s\n", msgbuff);
free(fd);
fd = NULL;

View File

@ -55,7 +55,7 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) {
error = ERRNO;
error = errno;
fprintf(stderr, "fopen failed with error: %d (%s)\n",
error, strerror(error));
fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2);
@ -66,7 +66,7 @@ int test(char *URL)
hd = fstat(fileno(hd_src), &file_info);
if(hd == -1) {
/* can't open file, bail out */
error = ERRNO;
error = errno;
fprintf(stderr, "fstat() failed with error: %d (%s)\n",
error, strerror(error));
fprintf(stderr, "ERROR: cannot open file (%s)\n", libtest_arg2);

View File

@ -87,7 +87,7 @@ static int fopen_works(void)
for(i = 0; i < 3; i++) {
fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
if(fpa[i] == NULL) {
store_errmsg("fopen failed", ERRNO);
store_errmsg("fopen failed", errno);
fprintf(stderr, "%s\n", msgbuff);
ret = 0;
break;
@ -123,7 +123,7 @@ static int rlimit(int keep_open)
/* get initial open file limits */
if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
store_errmsg("getrlimit() failed", ERRNO);
store_errmsg("getrlimit() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
return -1;
}
@ -164,7 +164,7 @@ static int rlimit(int keep_open)
rl.rlim_cur = OPEN_MAX;
if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
/* on failure don't abort just issue a warning */
store_errmsg("setrlimit() failed", ERRNO);
store_errmsg("setrlimit() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
msgbuff[0] = '\0';
}
@ -175,7 +175,7 @@ static int rlimit(int keep_open)
rl.rlim_cur = rl.rlim_max;
if(setrlimit(RLIMIT_NOFILE, &rl) != 0) {
/* on failure don't abort just issue a warning */
store_errmsg("setrlimit() failed", ERRNO);
store_errmsg("setrlimit() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
msgbuff[0] = '\0';
}
@ -183,7 +183,7 @@ static int rlimit(int keep_open)
/* get current open file limits */
if(getrlimit(RLIMIT_NOFILE, &rl) != 0) {
store_errmsg("getrlimit() failed", ERRNO);
store_errmsg("getrlimit() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
return -3;
}
@ -242,7 +242,7 @@ static int rlimit(int keep_open)
}
} while(nitems && !memchunk);
if(!memchunk) {
store_errmsg("memchunk, malloc() failed", ERRNO);
store_errmsg("memchunk, malloc() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
return -4;
}
@ -297,7 +297,7 @@ static int rlimit(int keep_open)
}
} while(num_open.rlim_max && !fd);
if(!fd) {
store_errmsg("fd, malloc() failed", ERRNO);
store_errmsg("fd, malloc() failed", errno);
fprintf(stderr, "%s\n", msgbuff);
free(memchunk);
return -6;
@ -320,7 +320,7 @@ static int rlimit(int keep_open)
fd[0] = open(DEV_NULL, O_RDONLY);
if(fd[0] < 0) {
snprintf(strbuff, sizeof(strbuff), "opening of %s failed", DEV_NULL);
store_errmsg(strbuff, ERRNO);
store_errmsg(strbuff, errno);
fprintf(stderr, "%s\n", msgbuff);
free(fd);
fd = NULL;

View File

@ -47,7 +47,7 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) {
error = ERRNO;
error = errno;
fprintf(stderr, "fopen failed with error: %d %s\n",
error, strerror(error));
fprintf(stderr, "Error opening file: %s\n", libtest_arg2);
@ -58,7 +58,7 @@ int test(char *URL)
hd = fstat(fileno(hd_src), &file_info);
if(hd == -1) {
/* can't open file, bail out */
error = ERRNO;
error = errno;
fprintf(stderr, "fstat() failed with error: %d %s\n",
error, strerror(error));
fprintf(stderr, "ERROR: cannot open file %s\n", libtest_arg2);

View File

@ -244,7 +244,7 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) {
error = ERRNO;
error = errno;
fprintf(stderr, "fopen() failed with error: %d (%s)\n",
error, strerror(error));
fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2);
@ -255,7 +255,7 @@ int test(char *URL)
hd = fstat(fileno(hd_src), &file_info);
if(hd == -1) {
/* can't open file, bail out */
error = ERRNO;
error = errno;
fprintf(stderr, "fstat() failed with error: %d (%s)\n",
error, strerror(error));
fprintf(stderr, "ERROR: cannot open file (%s)\n", libtest_arg2);

View File

@ -50,7 +50,7 @@ int test(char *URL)
upload = fopen(libtest_arg3, "rb");
if(!upload) {
error = ERRNO;
error = errno;
fprintf(stderr, "fopen() failed with error: %d (%s)\n",
error, strerror(error));
fprintf(stderr, "Error opening file: (%s)\n", libtest_arg3);