summaryrefslogtreecommitdiff
path: root/networking/tftp.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2008-01-29 10:33:34 +0000
committerBernhard Reutner-Fischer2008-01-29 10:33:34 +0000
commit8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15 (patch)
tree998a337ecd57b737423a3793365519213f97da72 /networking/tftp.c
parentc882f341cec8451ee87af6746abb7208272d5b1a (diff)
downloadbusybox-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.zip
busybox-8c69afd992d7cc6c2fc7dea59c3c2bd3f3c21f15.tar.gz
- be C99 friendly. Anonymous unions are a GNU extension. This change is
size-neutral WRT -std=gnu99 and fixes several compilation errors for strict C99 mode.
Diffstat (limited to 'networking/tftp.c')
-rw-r--r--networking/tftp.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/networking/tftp.c b/networking/tftp.c
index a268397..737ae78 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -127,7 +127,7 @@ static int tftp( USE_GETPUT(const int cmd,)
char *cp;
unsigned org_port;
- len_and_sockaddr *const from = alloca(offsetof(len_and_sockaddr, sa) + peer_lsa->len);
+ len_and_sockaddr *const from = alloca(offsetof(len_and_sockaddr, u.sa) + peer_lsa->len);
/* Can't use RESERVE_CONFIG_BUFFER here since the allocation
* size varies meaning BUFFERS_GO_ON_STACK would fail */
@@ -138,7 +138,7 @@ static int tftp( USE_GETPUT(const int cmd,)
port = org_port = htons(port);
- socketfd = xsocket(peer_lsa->sa.sa_family, SOCK_DGRAM, 0);
+ socketfd = xsocket(peer_lsa->u.sa.sa_family, SOCK_DGRAM, 0);
/* build opcode */
opcode = TFTP_WRQ;
@@ -216,7 +216,7 @@ static int tftp( USE_GETPUT(const int cmd,)
fprintf(stderr, "%02x ", (unsigned char) *cp);
fprintf(stderr, "\n");
#endif
- xsendto(socketfd, xbuf, send_len, &peer_lsa->sa, peer_lsa->len);
+ xsendto(socketfd, xbuf, send_len, &peer_lsa->u.sa, peer_lsa->len);
/* Was it final ACK? then exit */
if (finished && (opcode == TFTP_ACK))
goto ret;
@@ -229,14 +229,14 @@ static int tftp( USE_GETPUT(const int cmd,)
unsigned from_port;
case 1:
from->len = peer_lsa->len;
- memset(&from->sa, 0, peer_lsa->len);
+ memset(&from->u.sa, 0, peer_lsa->len);
len = recvfrom(socketfd, rbuf, tftp_bufsize, 0,
- &from->sa, &from->len);
+ &from->u.sa, &from->len);
if (len < 0) {
bb_perror_msg("recvfrom");
goto ret;
}
- from_port = get_nport(&from->sa);
+ from_port = get_nport(&from->u.sa);
if (port == org_port) {
/* Our first query went to port 69
* but reply will come from different one.
@@ -316,7 +316,7 @@ static int tftp( USE_GETPUT(const int cmd,)
/*static const uint16_t error_8[2] = { htons(TFTP_ERROR), htons(8) };*/
/* thus we open-code big-endian layout */
static const uint8_t error_8[4] = { 0,TFTP_ERROR, 0,8 };
- xsendto(socketfd, error_8, 4, &peer_lsa->sa, peer_lsa->len);
+ xsendto(socketfd, error_8, 4, &peer_lsa->u.sa, peer_lsa->len);
bb_error_msg("server proposes bad blksize %d, exiting", blksize);
goto ret;
}
@@ -449,7 +449,7 @@ int tftp_main(int argc, char **argv)
#if ENABLE_DEBUG_TFTP
fprintf(stderr, "using server '%s', remotefile '%s', localfile '%s'\n",
- xmalloc_sockaddr2dotted(&peer_lsa->sa),
+ xmalloc_sockaddr2dotted(&peer_lsa->u.sa),
remotefile, localfile);
#endif