test->state needs to be explicitly signed char to accomodate a couple
of error states which are negative. On most systems this doesn't matter because char is signed, but on ARM CPUs char is unsigned.
This commit is contained in:
parent
cb6347fba9
commit
019434022c
@ -131,7 +131,7 @@ struct iperf_test
|
|||||||
int sender; /* client & !reverse or server & reverse */
|
int sender; /* client & !reverse or server & reverse */
|
||||||
int sender_has_retransmits;
|
int sender_has_retransmits;
|
||||||
struct protocol *protocol;
|
struct protocol *protocol;
|
||||||
char state;
|
signed char state;
|
||||||
char *server_hostname; /* -c option */
|
char *server_hostname; /* -c option */
|
||||||
char *bind_address; /* -B option */
|
char *bind_address; /* -B option */
|
||||||
int server_port;
|
int server_port;
|
||||||
|
@ -1206,7 +1206,7 @@ JSON_read(int fd)
|
|||||||
|
|
||||||
if (Nread(fd, (char*) &nsize, sizeof(nsize), Ptcp) >= 0) {
|
if (Nread(fd, (char*) &nsize, sizeof(nsize), Ptcp) >= 0) {
|
||||||
hsize = ntohl(nsize);
|
hsize = ntohl(nsize);
|
||||||
str = (char *) malloc((hsize+1) * sizeof(char)); /* +1 for EOS */
|
str = (char *) malloc(hsize+1); /* +1 for EOS */
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
if (Nread(fd, str, hsize, Ptcp) >= 0) {
|
if (Nread(fd, str, hsize, Ptcp) >= 0) {
|
||||||
str[hsize] = '\0'; /* add the EOS */
|
str[hsize] = '\0'; /* add the EOS */
|
||||||
|
@ -186,7 +186,7 @@ iperf_handle_message_client(struct iperf_test *test)
|
|||||||
{
|
{
|
||||||
int rval, perr;
|
int rval, perr;
|
||||||
|
|
||||||
if ((rval = read(test->ctrl_sck, &test->state, sizeof(char))) <= 0) {
|
if ((rval = read(test->ctrl_sck, (char*) &test->state, sizeof(signed char))) <= 0) {
|
||||||
if (rval == 0) {
|
if (rval == 0) {
|
||||||
i_errno = IECTRLCLOSE;
|
i_errno = IECTRLCLOSE;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -154,7 +154,7 @@ iperf_handle_message_server(struct iperf_test *test)
|
|||||||
struct iperf_stream *sp;
|
struct iperf_stream *sp;
|
||||||
|
|
||||||
// XXX: Need to rethink how this behaves to fit API
|
// XXX: Need to rethink how this behaves to fit API
|
||||||
if ((rval = Nread(test->ctrl_sck, &test->state, sizeof(char), Ptcp)) <= 0) {
|
if ((rval = Nread(test->ctrl_sck, (char*) &test->state, sizeof(signed char), Ptcp)) <= 0) {
|
||||||
if (rval == 0) {
|
if (rval == 0) {
|
||||||
iperf_err(test, "the client has unexpectedly closed the connection");
|
iperf_err(test, "the client has unexpectedly closed the connection");
|
||||||
i_errno = IECTRLCLOSE;
|
i_errno = IECTRLCLOSE;
|
||||||
|
@ -79,7 +79,7 @@ int
|
|||||||
iperf_tcp_accept(struct iperf_test * test)
|
iperf_tcp_accept(struct iperf_test * test)
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
int rbuf = ACCESS_DENIED;
|
signed char rbuf = ACCESS_DENIED;
|
||||||
char cookie[COOKIE_SIZE];
|
char cookie[COOKIE_SIZE];
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
@ -96,7 +96,7 @@ iperf_tcp_accept(struct iperf_test * test)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(test->cookie, cookie) != 0) {
|
if (strcmp(test->cookie, cookie) != 0) {
|
||||||
if (Nwrite(s, (char*) &rbuf, sizeof(char), Ptcp) < 0) {
|
if (Nwrite(s, (char*) &rbuf, sizeof(signed char), Ptcp) < 0) {
|
||||||
i_errno = IESENDMESSAGE;
|
i_errno = IESENDMESSAGE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ main(int argc, char **argv)
|
|||||||
if (setjmp(env)) {
|
if (setjmp(env)) {
|
||||||
if (test->ctrl_sck >= 0) {
|
if (test->ctrl_sck >= 0) {
|
||||||
test->state = (test->role == 'c') ? CLIENT_TERMINATE : SERVER_TERMINATE;
|
test->state = (test->role == 'c') ? CLIENT_TERMINATE : SERVER_TERMINATE;
|
||||||
if (Nwrite(test->ctrl_sck, &test->state, sizeof(char), Ptcp) < 0) {
|
if (Nwrite(test->ctrl_sck, (char*) &test->state, sizeof(signed char), Ptcp) < 0) {
|
||||||
i_errno = IESENDMESSAGE;
|
i_errno = IESENDMESSAGE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user