diff options
author | Daniel Stenberg <daniel@haxx.se> | 2003-04-15 14:18:37 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2003-04-15 14:18:37 +0000 |
commit | 9a12db1aa2128abbb82ecfc4904a90b9941d1261 (patch) | |
tree | e9107a484d359ebf5cd920909c42c76a35eaf7af | |
parent | eb54d34becbe1b3541484964d376dd294416cee3 (diff) | |
download | curl-9a12db1aa2128abbb82ecfc4904a90b9941d1261.tar.gz |
typecast the setting of the size, as it might be an off_t which is bigger
than long and libcurl expects a long...
-rw-r--r-- | tests/libtest/lib505.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c index 9aeb878bc..6945598c1 100644 --- a/tests/libtest/lib505.c +++ b/tests/libtest/lib505.c @@ -47,13 +47,16 @@ CURLcode test(char *URL) const char *buf_2 = "RNTO 505-forreal"; /* get the file size of the local file */ - hd = open(arg2, O_RDONLY) ; + hd = stat(arg2, &file_info); if(hd == -1) { /* can't open file, bail out */ return -1; } - fstat(hd, &file_info); - close(hd); + + if(! file_info.st_size) { + fprintf(stderr, "WARNING: file %s has no size!\n", arg2); + return -4; + } /* get a FILE * of the same file, could also be made with fdopen() from the previous descriptor, but hey this is just @@ -89,7 +92,8 @@ CURLcode test(char *URL) curl_easy_setopt(curl, CURLOPT_INFILE, hd_src); /* and give the size of the upload (optional) */ - curl_easy_setopt(curl, CURLOPT_INFILESIZE, file_info.st_size); + curl_easy_setopt(curl, CURLOPT_INFILESIZE, + (long)file_info.st_size); /* Now run off and do what you've been told! */ res = curl_easy_perform(curl); |