aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-02-16 19:17:05 +0000
committerYang Tse <yangsita@gmail.com>2007-02-16 19:17:05 +0000
commit4dc453c08796da93eaa82a0af36029c265893300 (patch)
tree475eaec57058a81efce9032501b6236e64ee6846 /tests/libtest
parenta1d598399146984c99baa46db148e87c75261033 (diff)
add debug messages for fopen() failures
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/lib505.c8
-rw-r--r--tests/libtest/lib525.c8
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c
index 85ce38b32..098e8f9e0 100644
--- a/tests/libtest/lib505.c
+++ b/tests/libtest/lib505.c
@@ -43,6 +43,7 @@ int test(char *URL)
int hd ;
struct_stat file_info;
struct curl_slist *hl;
+ int error;
struct curl_slist *headerlist=NULL;
const char *buf_1 = "RNFR 505";
@@ -57,6 +58,9 @@ int test(char *URL)
hd = stat(arg2, &file_info);
if(hd == -1) {
/* can't open file, bail out */
+ error = ERRNO;
+ fprintf(stderr, "stat() failed with error: %d %s\n",
+ error, strerror(error));
fprintf(stderr, "WARNING: cannot open file %s\n", arg2);
return -1;
}
@@ -71,6 +75,10 @@ int test(char *URL)
an example! */
hd_src = fopen(arg2, "rb");
if(NULL == hd_src) {
+ error = ERRNO;
+ fprintf(stderr, "fopen() failed with error: %d %s\n",
+ error, strerror(error));
+ fprintf(stderr, "Error opening file: %s\n", arg2);
return -2; /* if this happens things are major weird */
}
diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c
index ce12b3b84..14e0c0c76 100644
--- a/tests/libtest/lib525.c
+++ b/tests/libtest/lib525.c
@@ -25,6 +25,7 @@ int test(char *URL)
CURL *curl;
FILE *hd_src ;
int hd ;
+ int error;
struct_stat file_info;
int running;
char done=FALSE;
@@ -48,6 +49,13 @@ int test(char *URL)
fdopen() from the previous descriptor, but hey this is just
an example! */
hd_src = fopen(arg2, "rb");
+ if(NULL == hd_src) {
+ error = ERRNO;
+ fprintf(stderr, "fopen() failed with error: %d %s\n",
+ error, strerror(error));
+ fprintf(stderr, "Error opening file: %s\n", arg2);
+ return TEST_ERR_MAJOR_BAD;
+ }
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");