summaryrefslogtreecommitdiff
path: root/tests/libtest/lib568.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-01-28 10:27:09 +0000
committerYang Tse <yangsita@gmail.com>2010-01-28 10:27:09 +0000
commiteff18763a1fdc37a45321dfc95f7bbfcec89777f (patch)
treed062d581297703d5699f2b0436629aef74635a99 /tests/libtest/lib568.c
parent3e21f1e971c7467b488a29a5da1f408c8e954b09 (diff)
downloadgnurl-eff18763a1fdc37a45321dfc95f7bbfcec89777f.tar.gz
gnurl-eff18763a1fdc37a45321dfc95f7bbfcec89777f.tar.bz2
gnurl-eff18763a1fdc37a45321dfc95f7bbfcec89777f.zip
portability fix
Diffstat (limited to 'tests/libtest/lib568.c')
-rw-r--r--tests/libtest/lib568.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c
index 5e59a9cae..c9406b0ec 100644
--- a/tests/libtest/lib568.c
+++ b/tests/libtest/lib568.c
@@ -10,10 +10,12 @@
#include "test.h"
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
+#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
#include <curl/mprintf.h>
@@ -34,7 +36,7 @@ int test(char *URL)
CURL *curl;
int sdp;
FILE *sdpf;
- struct stat file_info;
+ struct_stat file_info;
char *stream_uri;
int request=1;
struct curl_slist *custom_headers=NULL;
@@ -61,9 +63,10 @@ int test(char *URL)
sdp = open("log/file568.txt", O_RDONLY);
fstat(sdp, &file_info);
- sdpf = fdopen(sdp, "rb");
+ close(sdp);
+
+ sdpf = fopen("log/file568.txt", "rb");
if(sdpf == NULL) {
- close(sdp);
fprintf(stderr, "can't open log/file568.txt\n");
return TEST_ERR_MAJOR_BAD;
}
@@ -77,13 +80,11 @@ int test(char *URL)
res = curl_easy_perform(curl);
if(res) {
fclose(sdpf);
- close(sdp);
return res;
}
curl_easy_setopt(curl, CURLOPT_UPLOAD, 0L);
fclose(sdpf);
- close(sdp);
/* Make sure we can do a normal request now */
stream_uri = suburl(URL, request++);