portability fix
This commit is contained in:
Родитель
3e21f1e971
Коммит
eff18763a1
|
@ -10,10 +10,12 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#ifdef HAVE_SYS_STAT_H
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ int test(char *URL)
|
||||||
CURL *curl;
|
CURL *curl;
|
||||||
int sdp;
|
int sdp;
|
||||||
FILE *sdpf;
|
FILE *sdpf;
|
||||||
struct stat file_info;
|
struct_stat file_info;
|
||||||
char *stream_uri;
|
char *stream_uri;
|
||||||
int request=1;
|
int request=1;
|
||||||
struct curl_slist *custom_headers=NULL;
|
struct curl_slist *custom_headers=NULL;
|
||||||
|
@ -61,9 +63,10 @@ int test(char *URL)
|
||||||
|
|
||||||
sdp = open("log/file568.txt", O_RDONLY);
|
sdp = open("log/file568.txt", O_RDONLY);
|
||||||
fstat(sdp, &file_info);
|
fstat(sdp, &file_info);
|
||||||
sdpf = fdopen(sdp, "rb");
|
close(sdp);
|
||||||
|
|
||||||
|
sdpf = fopen("log/file568.txt", "rb");
|
||||||
if(sdpf == NULL) {
|
if(sdpf == NULL) {
|
||||||
close(sdp);
|
|
||||||
fprintf(stderr, "can't open log/file568.txt\n");
|
fprintf(stderr, "can't open log/file568.txt\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
}
|
}
|
||||||
|
@ -77,13 +80,11 @@ int test(char *URL)
|
||||||
res = curl_easy_perform(curl);
|
res = curl_easy_perform(curl);
|
||||||
if(res) {
|
if(res) {
|
||||||
fclose(sdpf);
|
fclose(sdpf);
|
||||||
close(sdp);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_setopt(curl, CURLOPT_UPLOAD, 0L);
|
curl_easy_setopt(curl, CURLOPT_UPLOAD, 0L);
|
||||||
fclose(sdpf);
|
fclose(sdpf);
|
||||||
close(sdp);
|
|
||||||
|
|
||||||
/* Make sure we can do a normal request now */
|
/* Make sure we can do a normal request now */
|
||||||
stream_uri = suburl(URL, request++);
|
stream_uri = suburl(URL, request++);
|
||||||
|
|
|
@ -33,7 +33,7 @@ int test(char *URL)
|
||||||
int i;
|
int i;
|
||||||
FILE *idfile;
|
FILE *idfile;
|
||||||
|
|
||||||
idfile = fopen(libtest_arg2, "w");
|
idfile = fopen(libtest_arg2, "wb");
|
||||||
if(idfile == NULL) {
|
if(idfile == NULL) {
|
||||||
fprintf(stderr, "couldn't open the Session ID File\n");
|
fprintf(stderr, "couldn't open the Session ID File\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
|
|
|
@ -10,10 +10,12 @@
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#ifdef HAVE_SYS_STAT_H
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_FCNTL_H
|
||||||
|
#include <fcntl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <curl/mprintf.h>
|
#include <curl/mprintf.h>
|
||||||
|
|
||||||
|
@ -67,7 +69,7 @@ int test(char *URL)
|
||||||
int request=1;
|
int request=1;
|
||||||
FILE *protofile;
|
FILE *protofile;
|
||||||
|
|
||||||
protofile = fopen(libtest_arg2, "w");
|
protofile = fopen(libtest_arg2, "wb");
|
||||||
if(protofile == NULL) {
|
if(protofile == NULL) {
|
||||||
fprintf(stderr, "Couldn't open the protocol dump file\n");
|
fprintf(stderr, "Couldn't open the protocol dump file\n");
|
||||||
return TEST_ERR_MAJOR_BAD;
|
return TEST_ERR_MAJOR_BAD;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче