summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTAW Dev <tawdev@taw>2009-07-06 11:49:58 -0400
committerTAW Dev <tawdev@taw>2009-07-06 11:49:58 -0400
commite9c1a79b6306783d63655eca5ddbcca0b6d825d0 (patch)
tree69116c5512190eba57b2ed2daa52f15e469ed36c
parentd23c620a88ac71c68af195f5fe82b09ee171187f (diff)
parentad8f53edc80811b933c9e2e0f469ef6e6a25972d (diff)
downloadtmwa-e9c1a79b6306783d63655eca5ddbcca0b6d825d0.tar.gz
tmwa-e9c1a79b6306783d63655eca5ddbcca0b6d825d0.tar.bz2
tmwa-e9c1a79b6306783d63655eca5ddbcca0b6d825d0.tar.xz
tmwa-e9c1a79b6306783d63655eca5ddbcca0b6d825d0.zip
Merge branch 'master' of git://gitorious.org/tmw-eathena/mainline
-rw-r--r--.gitignore1
-rwxr-xr-xeathena-monitorbin18336 -> 0 bytes
-rw-r--r--eathena-monitor.c28
-rw-r--r--src/common/socket.c17
4 files changed, 32 insertions, 14 deletions
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
diff --git a/eathena-monitor b/eathena-monitor
deleted file mode 100755
index fd1d36c..0000000
--- a/eathena-monitor
+++ /dev/null
Binary files 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 <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
{