diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-02-16 19:31:20 -0800 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-02-16 19:31:20 -0800 |
commit | a5d231b6a60a4ab868918850be24640e88843825 (patch) | |
tree | 4943e719f84374c7245707998d2297997fcd56cb | |
parent | b17b9021ecf9b16c265d0a6b60faa761b34eae35 (diff) | |
download | tmwa-a5d231b6a60a4ab868918850be24640e88843825.tar.gz tmwa-a5d231b6a60a4ab868918850be24640e88843825.tar.bz2 tmwa-a5d231b6a60a4ab868918850be24640e88843825.tar.xz tmwa-a5d231b6a60a4ab868918850be24640e88843825.zip |
Rotate logs in background
Also reenable the critical bonus effect.
-rw-r--r-- | src/map/map.cpp | 23 | ||||
-rw-r--r-- | src/map/map.t.hpp | 2 | ||||
-rw-r--r-- | src/map/pc.cpp | 2 |
3 files changed, 17 insertions, 10 deletions
diff --git a/src/map/map.cpp b/src/map/map.cpp index 6ed7662..d7cf4f6 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -1,8 +1,10 @@ #include "map.hpp" #include <sys/time.h> +#include <sys/wait.h> #include <netdb.h> +#include <unistd.h> #include <cstdlib> #include <cstring> @@ -1612,15 +1614,24 @@ void map_close_logfile(void) { if (map_logfile) { - std::string filenameop_buf = STRPRINTF( - "gzip -f %s.%ld", - map_logfile_name, - map_logfile_index); + std::string filename = STRPRINTF("%s.%ld", map_logfile_name, map_logfile_index); + const char *args[] = + { + "gzip", + "-f", + filename.c_str(), + NULL + }; + char **argv = const_cast<char **>(args); fclose(map_logfile); - if (!system(filenameop_buf.c_str())) - perror(filenameop_buf.c_str()); + if (!fork()) + { + execvp("gzip", argv); + _exit(1); + } + wait(NULL); } } diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp index e6417eb..09444fd 100644 --- a/src/map/map.t.hpp +++ b/src/map/map.t.hpp @@ -270,9 +270,7 @@ enum class SP : uint16_t #if 0 SPEED_RATE = 1018, #endif -#if 0 CRITICAL_DEF = 1019, -#endif #if 0 NEAR_ATK_DEF = 1020, #endif diff --git a/src/map/pc.cpp b/src/map/pc.cpp index c5fa07c..4eb49e3 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -1715,12 +1715,10 @@ int pc_bonus(struct map_session_data *sd, SP type, int val) sd->sprecov_rate += val; break; #endif -#if 0 case SP::CRITICAL_DEF: if (sd->state.lr_flag != 2) sd->critical_def += val; break; -#endif #if 0 case SP::DOUBLE_RATE: if (sd->state.lr_flag == 0 && sd->double_rate < val) |