aboutsummaryrefslogtreecommitdiff
path: root/tests/server/tftpd.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/server/tftpd.c')
-rw-r--r--tests/server/tftpd.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index a8b565197..c00731fa2 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -955,8 +955,6 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size)
int first = 1, ecode;
struct formats *pf;
char *filename, *mode = NULL;
- int error;
- FILE *server;
#ifdef USE_WINSOCK
DWORD recvtimeout, recvtimeoutbak;
#endif
@@ -964,9 +962,9 @@ static int do_tftp(struct testcase *test, struct tftphdr *tp, ssize_t size)
int toggle = 1;
/* Open request dump file. */
- server = fopen(REQUEST_DUMP, "ab");
+ FILE *server = fopen(REQUEST_DUMP, "ab");
if(!server) {
- error = errno;
+ int error = errno;
logmsg("fopen() failed with error: %d %s", error, strerror(error));
logmsg("Error opening file: %s", REQUEST_DUMP);
return -1;
@@ -1138,9 +1136,6 @@ static int validate_access(struct testcase *test,
const char *filename, int mode)
{
char *ptr;
- long testno, partno;
- int error;
- char partbuf[80]="data";
logmsg("trying to get file: %s mode %x", filename, mode);
@@ -1161,6 +1156,9 @@ static int validate_access(struct testcase *test,
ptr = strrchr(filename, '/');
if(ptr) {
+ char partbuf[80]="data";
+ long partno;
+ long testno;
char *file;
ptr++; /* skip the slash */
@@ -1194,7 +1192,7 @@ static int validate_access(struct testcase *test,
if(file) {
FILE *stream = fopen(file, "rb");
if(!stream) {
- error = errno;
+ int error = errno;
logmsg("fopen() failed with error: %d %s", error, strerror(error));
logmsg("Error opening file: %s", file);
logmsg("Couldn't open test file: %s", file);
@@ -1202,7 +1200,7 @@ static int validate_access(struct testcase *test,
}
else {
size_t count;
- error = getpart(&test->buffer, &count, "reply", partbuf, stream);
+ int error = getpart(&test->buffer, &count, "reply", partbuf, stream);
fclose(stream);
if(error) {
logmsg("getpart() failed with error: %d", error);