From cbb9bb3617952a7736f5047ba4a74eae29521599 Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Fri, 3 Jul 2009 16:36:49 +0200 Subject: Fix some includes. fixes mantis #760 reported by aidamax. --- eathena-monitor | Bin 18336 -> 11597 bytes eathena-monitor.c | 28 ++++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/eathena-monitor b/eathena-monitor index fd1d36c..b883334 100755 Binary files a/eathena-monitor and b/eathena-monitor differ diff --git a/eathena-monitor.c b/eathena-monitor.c index 13048d4..d0b3995 100644 --- a/eathena-monitor.c +++ b/eathena-monitor.c @@ -1,9 +1,9 @@ -/* -Name: eAthena processes monitor -Author: Bartosz Waszak -License: GPL -Compilation: -gcc -o eathena-monitor eathena-monitor.c +/** + * Name: eAthena processes monitor + * Author: Bartosz Waszak + * License: GPL + * Compilation: + * gcc -o eathena-monitor eathena-monitor.c */ #include @@ -11,7 +11,21 @@ gcc -o eathena-monitor eathena-monitor.c #include #include #include +#include + +#if !defined(linux) && (defined(__sgi) || defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__)) +#include +#endif + +#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__) +#include +#include +#endif + +#if defined(linux) || defined(__CYGWIN32__) || defined(__hpux) #include +#endif + #include #include #include @@ -25,7 +39,9 @@ gcc -o eathena-monitor eathena-monitor.c #define CHAR_SERVER "char-server" #define CONFIG "conf/eathena-monitor.conf" #define LOGFILE "log/eathena-monitor.log" +#ifndef PATH_MAX #define PATH_MAX 4096 +#endif #define IS_BLANK(ptr) \ (((*(ptr)) == ' ') || ((*(ptr)) == '\b') || \ -- cgit v1.2.3-70-g09d2 From 5ade89f4ef14e27d233c60ff72fca6c2e9b3501d Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Fri, 3 Jul 2009 16:48:25 +0200 Subject: Remove the binary from git. --- eathena-monitor | Bin 11597 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 eathena-monitor diff --git a/eathena-monitor b/eathena-monitor deleted file mode 100755 index b883334..0000000 Binary files a/eathena-monitor and /dev/null differ -- cgit v1.2.3-70-g09d2 From a7ff2a8e6ba97047c79ef305e2982f030277f588 Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Fri, 3 Jul 2009 16:50:42 +0200 Subject: Update .gitignore to disregard the eathena-monitor binary. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ba9c7cd..9cf4854 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ ladmin login-server map-server GNUmakefile +eathena-monitor -- cgit v1.2.3-70-g09d2 From e1871219cae287d32a3dff716f8824c1ead62001 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 5 Jul 2009 23:41:51 +0200 Subject: Bail out early from connect_client Don't use an invalid file descriptor in an attempt to create a session. --- src/common/socket.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/common/socket.c b/src/common/socket.c index 4543b6a..66093f7 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -146,10 +146,15 @@ static int connect_client(int listen_fd) //printf("connect_client : %d\n",listen_fd); - len=sizeof(client_address); + len = sizeof(client_address); - fd=accept(listen_fd,(struct sockaddr*)&client_address,&len); - if(fd_max<=fd) fd_max=fd+1; + fd = accept(listen_fd,(struct sockaddr*)&client_address,&len); + if (fd_max <= fd) { + fd_max = fd + 1; + } else if (fd == -1) { + perror("accept"); + return; + } // setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,NULL,0); setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,(char *)&yes,sizeof yes); // reuse fix @@ -160,11 +165,7 @@ static int connect_client(int listen_fd) // setsockopt(fd,IPPROTO_TCP,TCP_NODELAY,NULL,0); setsockopt(fd,IPPROTO_TCP,TCP_NODELAY,(char *)&yes,sizeof yes); // reuse fix - if(fd==-1){ - perror("accept"); - } else { - FD_SET(fd,&readfds); - } + FD_SET(fd,&readfds); #ifdef LCCWIN32 { -- cgit v1.2.3-70-g09d2 From ad8f53edc80811b933c9e2e0f469ef6e6a25972d Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sun, 5 Jul 2009 23:52:02 +0200 Subject: The function should return a value --- src/common/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/socket.c b/src/common/socket.c index 66093f7..f968373 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -153,7 +153,7 @@ static int connect_client(int listen_fd) fd_max = fd + 1; } else if (fd == -1) { perror("accept"); - return; + return -1; } // setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,NULL,0); -- cgit v1.2.3-70-g09d2