mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 16:18:48 -05:00
attempt to fix compiler warning:
`variable' might be clobbered by `longjmp' or `vfork'
This commit is contained in:
parent
9786e7faeb
commit
e16bccbb91
@ -755,35 +755,36 @@ static void timer(int signum)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned short sendblock;
|
||||||
|
static struct tftphdr *sdp;
|
||||||
|
static struct tftphdr *sap; /* ack packet */
|
||||||
/*
|
/*
|
||||||
* Send the requested file.
|
* Send the requested file.
|
||||||
*/
|
*/
|
||||||
static void sendtftp(struct testcase *test, struct formats *pf)
|
static void sendtftp(struct testcase *test, struct formats *pf)
|
||||||
{
|
{
|
||||||
struct tftphdr *dp;
|
|
||||||
struct tftphdr *ap; /* ack packet */
|
|
||||||
unsigned short block = 1;
|
|
||||||
int size;
|
int size;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
|
sendblock = 1;
|
||||||
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
||||||
mysignal(SIGALRM, timer);
|
mysignal(SIGALRM, timer);
|
||||||
#endif
|
#endif
|
||||||
dp = r_init();
|
sdp = r_init();
|
||||||
ap = (struct tftphdr *)ackbuf;
|
sap = (struct tftphdr *)ackbuf;
|
||||||
do {
|
do {
|
||||||
size = readit(test, &dp, pf->f_convert);
|
size = readit(test, &sdp, pf->f_convert);
|
||||||
if (size < 0) {
|
if (size < 0) {
|
||||||
nak(ERRNO + 100);
|
nak(ERRNO + 100);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dp->th_opcode = htons((u_short)DATA);
|
sdp->th_opcode = htons((u_short)DATA);
|
||||||
dp->th_block = htons((u_short)block);
|
sdp->th_block = htons((u_short)sendblock);
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
#ifdef HAVE_SIGSETJMP
|
#ifdef HAVE_SIGSETJMP
|
||||||
(void) sigsetjmp(timeoutbuf, 1);
|
(void) sigsetjmp(timeoutbuf, 1);
|
||||||
#endif
|
#endif
|
||||||
send_data:
|
send_data:
|
||||||
if (swrite(peer, dp, size + 4) != size + 4) {
|
if (swrite(peer, sdp, size + 4) != size + 4) {
|
||||||
logmsg("write\n");
|
logmsg("write\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -800,27 +801,27 @@ static void sendtftp(struct testcase *test, struct formats *pf)
|
|||||||
logmsg("read: fail\n");
|
logmsg("read: fail\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ap->th_opcode = ntohs((u_short)ap->th_opcode);
|
sap->th_opcode = ntohs((u_short)sap->th_opcode);
|
||||||
ap->th_block = ntohs((u_short)ap->th_block);
|
sap->th_block = ntohs((u_short)sap->th_block);
|
||||||
|
|
||||||
if (ap->th_opcode == ERROR) {
|
if (sap->th_opcode == ERROR) {
|
||||||
logmsg("got ERROR");
|
logmsg("got ERROR");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ap->th_opcode == ACK) {
|
if (sap->th_opcode == ACK) {
|
||||||
if (ap->th_block == block) {
|
if (sap->th_block == sendblock) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Re-synchronize with the other side */
|
/* Re-synchronize with the other side */
|
||||||
(void) synchnet(peer);
|
(void) synchnet(peer);
|
||||||
if (ap->th_block == (block -1)) {
|
if (sap->th_block == (sendblock-1)) {
|
||||||
goto send_data;
|
goto send_data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
block++;
|
sendblock++;
|
||||||
} while (size == SEGSIZE);
|
} while (size == SEGSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,25 +831,26 @@ static void justtimeout(int signum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static unsigned short recvblock;
|
||||||
|
static struct tftphdr *rdp;
|
||||||
|
static struct tftphdr *rap; /* ack buffer */
|
||||||
/*
|
/*
|
||||||
* Receive a file.
|
* Receive a file.
|
||||||
*/
|
*/
|
||||||
static void recvtftp(struct testcase *test, struct formats *pf)
|
static void recvtftp(struct testcase *test, struct formats *pf)
|
||||||
{
|
{
|
||||||
struct tftphdr *dp;
|
|
||||||
struct tftphdr *ap; /* ack buffer */
|
|
||||||
unsigned short block = 0;
|
|
||||||
ssize_t n, size;
|
ssize_t n, size;
|
||||||
|
recvblock = 0;
|
||||||
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
||||||
mysignal(SIGALRM, timer);
|
mysignal(SIGALRM, timer);
|
||||||
#endif
|
#endif
|
||||||
dp = w_init();
|
rdp = w_init();
|
||||||
ap = (struct tftphdr *)ackbuf;
|
rap = (struct tftphdr *)ackbuf;
|
||||||
do {
|
do {
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
ap->th_opcode = htons((u_short)ACK);
|
rap->th_opcode = htons((u_short)ACK);
|
||||||
ap->th_block = htons((u_short)block);
|
rap->th_block = htons((u_short)recvblock);
|
||||||
block++;
|
recvblock++;
|
||||||
#ifdef HAVE_SIGSETJMP
|
#ifdef HAVE_SIGSETJMP
|
||||||
(void) sigsetjmp(timeoutbuf, 1);
|
(void) sigsetjmp(timeoutbuf, 1);
|
||||||
#endif
|
#endif
|
||||||
@ -862,7 +864,7 @@ send_ack:
|
|||||||
#ifdef HAVE_ALARM
|
#ifdef HAVE_ALARM
|
||||||
alarm(rexmtval);
|
alarm(rexmtval);
|
||||||
#endif
|
#endif
|
||||||
n = sread(peer, dp, PKTSIZE);
|
n = sread(peer, rdp, PKTSIZE);
|
||||||
#ifdef HAVE_ALARM
|
#ifdef HAVE_ALARM
|
||||||
alarm(0);
|
alarm(0);
|
||||||
#endif
|
#endif
|
||||||
@ -870,22 +872,22 @@ send_ack:
|
|||||||
logmsg("read: fail\n");
|
logmsg("read: fail\n");
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
dp->th_opcode = ntohs((u_short)dp->th_opcode);
|
rdp->th_opcode = ntohs((u_short)rdp->th_opcode);
|
||||||
dp->th_block = ntohs((u_short)dp->th_block);
|
rdp->th_block = ntohs((u_short)rdp->th_block);
|
||||||
if (dp->th_opcode == ERROR)
|
if (rdp->th_opcode == ERROR)
|
||||||
goto abort;
|
goto abort;
|
||||||
if (dp->th_opcode == DATA) {
|
if (rdp->th_opcode == DATA) {
|
||||||
if (dp->th_block == block) {
|
if (rdp->th_block == recvblock) {
|
||||||
break; /* normal */
|
break; /* normal */
|
||||||
}
|
}
|
||||||
/* Re-synchronize with the other side */
|
/* Re-synchronize with the other side */
|
||||||
(void) synchnet(peer);
|
(void) synchnet(peer);
|
||||||
if (dp->th_block == (block-1))
|
if (rdp->th_block == (recvblock-1))
|
||||||
goto send_ack; /* rexmit */
|
goto send_ack; /* rexmit */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size = writeit(test, &dp, (int)(n - 4), pf->f_convert);
|
size = writeit(test, &rdp, (int)(n - 4), pf->f_convert);
|
||||||
if (size != (n-4)) { /* ahem */
|
if (size != (n-4)) { /* ahem */
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
nak(ERRNO + 100);
|
nak(ERRNO + 100);
|
||||||
@ -896,8 +898,8 @@ send_ack:
|
|||||||
} while (size == SEGSIZE);
|
} while (size == SEGSIZE);
|
||||||
write_behind(test, pf->f_convert);
|
write_behind(test, pf->f_convert);
|
||||||
|
|
||||||
ap->th_opcode = htons((u_short)ACK); /* send the "final" ack */
|
rap->th_opcode = htons((u_short)ACK); /* send the "final" ack */
|
||||||
ap->th_block = htons((u_short)(block));
|
rap->th_block = htons((u_short)recvblock);
|
||||||
(void) swrite(peer, ackbuf, 4);
|
(void) swrite(peer, ackbuf, 4);
|
||||||
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
#if defined(HAVE_ALARM) && defined(SIGALRM)
|
||||||
mysignal(SIGALRM, justtimeout); /* just abort read on timeout */
|
mysignal(SIGALRM, justtimeout); /* just abort read on timeout */
|
||||||
@ -908,8 +910,8 @@ send_ack:
|
|||||||
alarm(0);
|
alarm(0);
|
||||||
#endif
|
#endif
|
||||||
if (n >= 4 && /* if read some data */
|
if (n >= 4 && /* if read some data */
|
||||||
dp->th_opcode == DATA && /* and got a data block */
|
rdp->th_opcode == DATA && /* and got a data block */
|
||||||
block == dp->th_block) { /* then my last ack was lost */
|
recvblock == rdp->th_block) { /* then my last ack was lost */
|
||||||
(void) swrite(peer, ackbuf, 4); /* resend final ack */
|
(void) swrite(peer, ackbuf, 4); /* resend final ack */
|
||||||
}
|
}
|
||||||
abort:
|
abort:
|
||||||
|
Loading…
Reference in New Issue
Block a user