diff options
author | Yang Tse <yangsita@gmail.com> | 2007-02-16 19:17:05 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2007-02-16 19:17:05 +0000 |
commit | 4dc453c08796da93eaa82a0af36029c265893300 (patch) | |
tree | 475eaec57058a81efce9032501b6236e64ee6846 /tests/libtest/lib505.c | |
parent | a1d598399146984c99baa46db148e87c75261033 (diff) | |
download | curl-4dc453c08796da93eaa82a0af36029c265893300.tar.gz |
add debug messages for fopen() failures
Diffstat (limited to 'tests/libtest/lib505.c')
-rw-r--r-- | tests/libtest/lib505.c | 8 |
1 files changed, 8 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 */ } |