From 716c400ab53268b432045b8f2883285d22ce650c Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 2 Apr 2013 15:26:08 -0300 Subject: Fixed Bug #7145 woo another system-dependent error (actually osx network buffer noticed the error and fixed it and that didnt let it happen while i was testing in it, nevertheless it was my fault and not windows +__+) http://hercules.ws/board/tracker/issue-7145-error-when-starting-the-emulator/ Signed-off-by: shennetsind --- src/common/socket.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/common/socket.c') diff --git a/src/common/socket.c b/src/common/socket.c index 701fbc685..79ccdf5dc 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1411,20 +1411,21 @@ void socket_datasync(int fd, bool send) { { sizeof(struct fame_list) }, }; unsigned short i; + unsigned int alen = ARRAYLENGTH(data_list); if( send ) { - unsigned short p_len = ( sizeof(data_list) * 4 ) + 4; + unsigned short p_len = ( alen * 4 ) + 4; WFIFOHEAD(fd, p_len); WFIFOW(fd, 0) = 0x2b0a; WFIFOW(fd, 2) = p_len; - for( i = 0; i < sizeof(data_list); i++ ) { + for( i = 0; i < alen; i++ ) { WFIFOL(fd, 4 + ( i * 4 ) ) = data_list[i].length; } WFIFOSET(fd, p_len); } else { - for( i = 0; i < sizeof(data_list); i++ ) { + for( i = 0; i < alen; i++ ) { if( RFIFOL(fd, 4 + (i * 4) ) != data_list[i].length ) { /* force the other to go wrong too so both are taken down */ WFIFOHEAD(fd, 8); @@ -1434,7 +1435,7 @@ void socket_datasync(int fd, bool send) { WFIFOSET(fd, 8); flush_fifo(fd); /* shut down */ - ShowFatalError("Servers are out of sync! recompile from scratch\n"); + ShowFatalError("Servers are out of sync! recompile from scratch (%d)\n",i); exit(EXIT_FAILURE); } } -- cgit v1.2.3-60-g2f50