Changeset 42009 in vbox for trunk/src/VBox/Devices/Network/slirp
- Timestamp:
- Jul 4, 2012 4:57:11 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/tftp.c
r41997 r42009 5 5 6 6 /* 7 * Copyright (C) 2006-201 0Oracle Corporation7 * Copyright (C) 2006-2012 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 68 68 uint16_t u16ClientPort; 69 69 int iTimestamp; 70 int cbTransfered; 70 71 ENMTFTPSESSIONFMT enmTftpFmt; 71 72 TFPTPSESSIONOPTDESC OptionBlkSize; … … 493 494 DECLINLINE(int) tftpReadDataBlock(PNATState pData, 494 495 PTFTPSESSION pcTftpSession, 495 uint16_t u16BlockNr,496 496 uint8_t *pu8Data, 497 497 int *pcbReadData) … … 521 521 { 522 522 rc = RTFileSeek(hSessionFile, 523 u16BlockNr * u16BlkSize,523 pcTftpSession->cbTransfered, 524 524 RTFILE_SEEK_BEGIN, 525 525 NULL); … … 647 647 struct mbuf *m; 648 648 PTFTPIPHDR pTftpIpHeader; 649 int nobytes; 650 int rc = VINF_SUCCESS; 651 652 /* we should be sure that we don't talk about file offset prior 0 ;) */ 653 if (block_nr < 1) 654 return -1; 649 int cbRead; 650 int rc = VINF_SUCCESS; 655 651 656 652 m = slirpTftpMbufAlloc(pData); … … 666 662 pTftpIpHeader->Core.u16TftpOpCode = RT_H2N_U16(block_nr); 667 663 668 rc = tftpReadDataBlock(pData, pTftpSession, block_nr - 1, (uint8_t *)&pTftpIpHeader->Core.u16TftpOpCode + sizeof(uint16_t), &nobytes);664 rc = tftpReadDataBlock(pData, pTftpSession, (uint8_t *)&pTftpIpHeader->Core.u16TftpOpCode + sizeof(uint16_t), &cbRead); 669 665 670 666 if (RT_SUCCESS(rc)) 671 667 { 672 m->m_len += nobytes; 668 pTftpSession->cbTransfered += cbRead; 669 m->m_len += cbRead; 673 670 tftpSend(pData, pTftpSession, m, pcTftpIpHeaderRecv); 674 if ( nobytes> 0)671 if (cbRead > 0) 675 672 tftpSessionUpdate(pData, pTftpSession); 676 673 else
Note:
See TracChangeset
for help on using the changeset viewer.