summaryrefslogtreecommitdiff
path: root/tests/libtest/lib582.c
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2017-07-11 01:53:23 -0400
committerJay Satiro <raysatiro@yahoo.com>2017-07-11 01:53:23 -0400
commitc5e87fdb7a60c1c4ef158a876e730b25be7a0894 (patch)
tree9927c02a601eedf82811146eb0ba8ff30d8c89cb /tests/libtest/lib582.c
parente909de65b907ae2be5874201b6881a5196e68c17 (diff)
downloadcurl-c5e87fdb7a60c1c4ef158a876e730b25be7a0894.tar.gz
strerror: Preserve Windows error code in some functions
This is a follow-up to af02162 which removed (SET_)ERRNO macros. That commit was an earlier draft that I committed by mistake, which was then remedied by a5834e5 and e909de6, and now this commit. With this commit there is now no difference between the current code and the changes that were approved in the final draft. Thanks-to: Max Dymond, Marcel Raad, Daniel Stenberg, Gisle Vanem Ref: https://github.com/curl/curl/pull/1589
Diffstat (limited to 'tests/libtest/lib582.c')
-rw-r--r--tests/libtest/lib582.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c
index 23772be59..f55e5de71 100644
--- a/tests/libtest/lib582.c
+++ b/tests/libtest/lib582.c
@@ -228,7 +228,6 @@ int test(char *URL)
CURL *curl = NULL;
FILE *hd_src = NULL;
int hd;
- int error;
struct_stat file_info;
CURLM *m = NULL;
struct ReadWriteSockets sockets = {{NULL, 0, 0}, {NULL, 0, 0}};
@@ -244,9 +243,8 @@ int test(char *URL)
hd_src = fopen(libtest_arg2, "rb");
if(NULL == hd_src) {
- error = errno;
fprintf(stderr, "fopen() failed with error: %d (%s)\n",
- error, strerror(error));
+ errno, strerror(errno));
fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2);
return TEST_ERR_FOPEN;
}
@@ -255,9 +253,8 @@ int test(char *URL)
hd = fstat(fileno(hd_src), &file_info);
if(hd == -1) {
/* can't open file, bail out */
- error = errno;
fprintf(stderr, "fstat() failed with error: %d (%s)\n",
- error, strerror(error));
+ errno, strerror(errno));
fprintf(stderr, "ERROR: cannot open file (%s)\n", libtest_arg2);
fclose(hd_src);
return TEST_ERR_FSTAT;