diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-10-14 19:46:21 +0000 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2006-10-14 19:46:21 +0000 |
| commit | 11f7e1ce1f76b7c1b04d5cba057f4e22d23b24f2 (patch) | |
| tree | bee24077728755f47f19f3004e7ba77eec2f5acd | |
| parent | 3fb4e5a894b687cebd614b60f7e6284356cab5de (diff) | |
| download | btpd-11f7e1ce1f76b7c1b04d5cba057f4e22d23b24f2.tar.gz btpd-11f7e1ce1f76b7c1b04d5cba057f4e22d23b24f2.zip | |
Safer way to initialize the address.
| -rw-r--r-- | btpd/peer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/btpd/peer.c b/btpd/peer.c index 5731e05..cb34585 100644 --- a/btpd/peer.c +++ b/btpd/peer.c @@ -321,8 +321,8 @@ peer_create_out_compact(struct net *n, const char *compact) struct sockaddr_in addr; addr.sin_family = AF_INET; - addr.sin_addr.s_addr = *(long *)compact; - addr.sin_port = *(short *)(compact + 4); + bcopy(compact, &addr.sin_addr.s_addr, 4); + bcopy(compact + 4, &addr.sin_port, 2); if (net_connect2((struct sockaddr *)&addr, sizeof(addr), &sd) != 0) return; |