diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | eathena-monitor | bin | 18336 -> 0 bytes | |||
-rw-r--r-- | eathena-monitor.c | 28 | ||||
-rw-r--r-- | src/common/socket.c | 17 |
4 files changed, 32 insertions, 14 deletions
@@ -5,3 +5,4 @@ ladmin login-server map-server GNUmakefile +eathena-monitor diff --git a/eathena-monitor b/eathena-monitor Binary files differdeleted file mode 100755 index fd1d36c..0000000 --- a/eathena-monitor +++ /dev/null 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 <waszi@evil.org.pl> -License: GPL -Compilation: -gcc -o eathena-monitor eathena-monitor.c +/** + * Name: eAthena processes monitor + * Author: Bartosz Waszak <waszi@evil.org.pl> + * License: GPL + * Compilation: + * gcc -o eathena-monitor eathena-monitor.c */ #include <unistd.h> @@ -11,7 +11,21 @@ gcc -o eathena-monitor eathena-monitor.c #include <string.h> #include <stdlib.h> #include <sys/types.h> +#include <sys/stat.h> + +#if !defined(linux) && (defined(__sgi) || defined(__sun__) || defined(__sun) || defined(__sparc) || defined(__sparc__)) +#include <sys/statfs.h> +#endif + +#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__) +#include <sys/param.h> +#include <sys/mount.h> +#endif + +#if defined(linux) || defined(__CYGWIN32__) || defined(__hpux) #include <sys/vfs.h> +#endif + #include <dirent.h> #include <errno.h> #include <time.h> @@ -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') || \ diff --git a/src/common/socket.c b/src/common/socket.c index 4543b6a..f968373 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 -1; + } // 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 { |