aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2016-11-12 12:33:10 +0100
committerDan Fandrich <dan@coneharvesters.com>2016-11-12 12:37:24 +0100
commit56bb7b1a3c17657a376a32f39eb7d2d15876a519 (patch)
treecf22c0c796fe929b4f598b67be44a0f5c5c3bbfe /tests
parentff662f1c3af6ca668f1bb15838cdbc856159d365 (diff)
tests: fixed variable might be clobbered warning
This stops the compiler from potentially making invalid assumptions about the immutability of sdp and sap across the longjmp boundary.
Diffstat (limited to 'tests')
-rw-r--r--tests/server/tftpd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index afc0884e0..07a063829 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -1232,19 +1232,17 @@ static void sendtftp(struct testcase *test, struct formats *pf)
{
int size;
ssize_t n;
- /* This is volatile to live through a siglongjmp */
+ /* These are volatile to live through a siglongjmp */
volatile unsigned short sendblock; /* block count */
- struct tftphdr *sdp; /* data buffer */
- struct tftphdr *sap; /* ack buffer */
+ struct tftphdr * volatile sdp = r_init(); /* data buffer */
+ struct tftphdr * const sap = &ackbuf.hdr; /* ack buffer */
sendblock = 1;
#if defined(HAVE_ALARM) && defined(SIGALRM)
mysignal(SIGALRM, timer);
#endif
- sdp = r_init();
- sap = &ackbuf.hdr;
do {
- size = readit(test, &sdp, pf->f_convert);
+ size = readit(test, (struct tftphdr **)&sdp, pf->f_convert);
if(size < 0) {
nak(errno + 100);
return;