diff options
author | gepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-02-13 20:17:45 +0000 |
---|---|---|
committer | gepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-02-13 20:17:45 +0000 |
commit | a2c4e6e95f61b28f0d59b90ad8e5567e4dccfd33 (patch) | |
tree | 6d4a85fd07bd57759c8fdaee884668ab663e716a | |
parent | 6a7c07ebe459e1aaa2a3e1f0438a170369a2535b (diff) | |
download | hercules-a2c4e6e95f61b28f0d59b90ad8e5567e4dccfd33.tar.gz hercules-a2c4e6e95f61b28f0d59b90ad8e5567e4dccfd33.tar.bz2 hercules-a2c4e6e95f61b28f0d59b90ad8e5567e4dccfd33.tar.xz hercules-a2c4e6e95f61b28f0d59b90ad8e5567e4dccfd33.zip |
Socket init now gives meaningful error description if failed to set socket limit (tid:58887).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15574 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | src/common/socket.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/common/socket.c b/src/common/socket.c index ce9f7db22..592755d5a 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1280,12 +1280,10 @@ void socket_init(void) rlp.rlim_cur = FD_SETSIZE; if( 0 != setrlimit(RLIMIT_NOFILE, &rlp) ) {// failed, try setting the maximum too (permission to change system limits is required) - int err; rlp.rlim_max = FD_SETSIZE; - err = setrlimit(RLIMIT_NOFILE, &rlp); - if( err != 0 ) + if( 0 != setrlimit(RLIMIT_NOFILE, &rlp) ) {// failed - const char* errmsg = "unknown"; + const char *errmsg = error_msg(); int rlim_ori; // set to maximum allowed getrlimit(RLIMIT_NOFILE, &rlp); @@ -1294,10 +1292,8 @@ void socket_init(void) setrlimit(RLIMIT_NOFILE, &rlp); // report limit getrlimit(RLIMIT_NOFILE, &rlp); - if( err == EPERM ) - errmsg = "permission denied"; - ShowWarning("socket_init: failed to set socket limit to %d, setting to maximum allowed (original limit=%d, current limit=%d, maximum allowed=%d, error=%s).\n", FD_SETSIZE, rlim_ori, (int)rlp.rlim_cur, (int)rlp.rlim_max, errmsg); rlim_cur = rlp.rlim_cur; + ShowWarning("socket_init: failed to set socket limit to %d, setting to maximum allowed (original limit=%d, current limit=%d, maximum allowed=%d, %s).\n", FD_SETSIZE, rlim_ori, (int)rlp.rlim_cur, (int)rlp.rlim_max, errmsg); } } } |