* Fixed a crash when freeing memory of pets
* Added Cygwin support to the -DDUMPSTACK option, and changed its format * Removed duplicate fopen in login_log git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1250 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
d2dd679325
commit
244c817d0d
@ -1,6 +1,10 @@
|
|||||||
Date Added
|
Date Added
|
||||||
|
|
||||||
03/18
|
03/18
|
||||||
|
* Fixed a crash when freeing memory of pets [celest]
|
||||||
|
* Added Cygwin support to the -DDUMPSTACK option, and changed its format
|
||||||
|
to "<server type><number>.stackdump", thanks to Ser [celest]
|
||||||
|
* Removed duplicate fopen in login_log [celest]
|
||||||
* Don't log SQL char actions if log_char is not enabled in char_athena.conf
|
* Don't log SQL char actions if log_char is not enabled in char_athena.conf
|
||||||
[celest]
|
[celest]
|
||||||
* Updated shop_exp's calculation to give more exp, thanks to tcdiem [celest]
|
* Updated shop_exp's calculation to give more exp, thanks to tcdiem [celest]
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
#include "memwatch.h"
|
#include "memwatch.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char server_type[24];
|
||||||
|
int runflag = 1;
|
||||||
|
unsigned long ticks = 0; // by MC Cameri
|
||||||
|
char pid_file[256];
|
||||||
static void (*term_func)(void)=NULL;
|
static void (*term_func)(void)=NULL;
|
||||||
|
|
||||||
/*======================================
|
/*======================================
|
||||||
@ -100,42 +104,58 @@ static void sig_proc(int sn)
|
|||||||
* Dumps the stack using glibc's backtrace
|
* Dumps the stack using glibc's backtrace
|
||||||
*-----------------------------------------
|
*-----------------------------------------
|
||||||
*/
|
*/
|
||||||
#ifdef CYGWIN
|
#ifndef DUMPSTACK
|
||||||
#define sig_dump SIG_DFL // allow cygwin's default dumper utility to handle this
|
#define sig_dump SIG_DFL
|
||||||
#else
|
#else
|
||||||
static void sig_dump(int sn)
|
#ifdef CYGWIN
|
||||||
|
#define FOPEN_ freopen
|
||||||
|
extern void cygwin_stackdump();
|
||||||
|
#else
|
||||||
|
#define FOPEN_(fn,m,s) fopen(fn,m)
|
||||||
|
#endif
|
||||||
|
extern const char *strsignal(int);
|
||||||
|
void sig_dump(int sn)
|
||||||
{
|
{
|
||||||
#ifdef DUMPSTACK
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
void* array[20];
|
char file[256];
|
||||||
|
int no = 0;
|
||||||
|
|
||||||
|
#ifndef CYGWIN
|
||||||
|
void* array[20];
|
||||||
char **stack;
|
char **stack;
|
||||||
size_t size;
|
size_t size;
|
||||||
int no = 0;
|
#endif
|
||||||
char tmp[256];
|
|
||||||
|
|
||||||
// search for a usable filename
|
// search for a usable filename
|
||||||
do {
|
do {
|
||||||
sprintf(tmp,"log/stackdump_%04d.txt", ++no);
|
sprintf (file, "log/%s%04d.stackdump", server_type, ++no);
|
||||||
} while((fp = fopen(tmp,"r")) && (fclose(fp), no < 9999));
|
} while((fp = fopen(file,"r")) && (fclose(fp), no < 9999));
|
||||||
// dump the trace into the file
|
// dump the trace into the file
|
||||||
if ((fp = fopen (tmp,"w")) != NULL) {
|
|
||||||
|
|
||||||
fprintf(fp,"Exception: %s\n", strsignal(sn));
|
if ((fp = FOPEN_(file, "w", stderr)) != NULL) {
|
||||||
fprintf(fp,"Stack trace:\n");
|
printf ("Dumping stack... ");
|
||||||
|
fprintf(fp, "Exception: %s \n", strsignal(sn));
|
||||||
|
fflush (fp);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CYGWIN
|
||||||
|
cygwin_stackdump ();
|
||||||
|
#else
|
||||||
|
fprintf(fp, "Stack trace:\n");
|
||||||
size = backtrace (array, 20);
|
size = backtrace (array, 20);
|
||||||
stack = backtrace_symbols (array, size);
|
stack = backtrace_symbols (array, size);
|
||||||
for (no = 0; no < size; no++) {
|
for (no = 0; no < size; no++) {
|
||||||
fprintf(fp, "%s\n", stack[no]);
|
fprintf(fp, "%s\n", stack[no]);
|
||||||
}
|
}
|
||||||
fprintf(fp,"End of stack trace\n");
|
fprintf(fp,"End of stack trace\n");
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
aFree(stack);
|
aFree(stack);
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
//cygwin_stackdump ();
|
|
||||||
// When pass the signal to the system's default handler
|
printf ("Done.\n");
|
||||||
|
fflush(stdout);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
// Pass the signal to the system's default handler
|
||||||
compat_signal(sn, SIG_DFL);
|
compat_signal(sn, SIG_DFL);
|
||||||
raise(sn);
|
raise(sn);
|
||||||
}
|
}
|
||||||
@ -202,11 +222,6 @@ static void display_title(void)
|
|||||||
*--------------------------------------
|
*--------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int runflag = 1;
|
|
||||||
unsigned long ticks = 0; // by MC Cameri
|
|
||||||
char pid_file[256];
|
|
||||||
char server_type[24];
|
|
||||||
|
|
||||||
void pid_delete(void) {
|
void pid_delete(void) {
|
||||||
unlink(pid_file);
|
unlink(pid_file);
|
||||||
}
|
}
|
||||||
@ -289,7 +304,7 @@ int main(int argc,char **argv)
|
|||||||
|
|
||||||
display_title();
|
display_title();
|
||||||
|
|
||||||
#ifndef BCHECK
|
#ifdef USE_MEMMGR
|
||||||
do_init_memmgr(argv[0]); // 一番最初に実行する必要がある
|
do_init_memmgr(argv[0]); // 一番最初に実行する必要がある
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -189,7 +189,6 @@ int login_log(char *fmt, ...) {
|
|||||||
if(!log_fp)
|
if(!log_fp)
|
||||||
log_fp = fopen(login_log_filename, "a");
|
log_fp = fopen(login_log_filename, "a");
|
||||||
|
|
||||||
log_fp = fopen(login_log_filename, "a");
|
|
||||||
if (log_fp) {
|
if (log_fp) {
|
||||||
if (fmt[0] == '\0') // jump a line if no message
|
if (fmt[0] == '\0') // jump a line if no message
|
||||||
fprintf(log_fp, RETCODE);
|
fprintf(log_fp, RETCODE);
|
||||||
|
@ -610,7 +610,8 @@ int pet_remove_map(struct map_session_data *sd)
|
|||||||
pet_hungry_timer_delete(sd);
|
pet_hungry_timer_delete(sd);
|
||||||
clif_clearchar_area(&sd->pd->bl,0);
|
clif_clearchar_area(&sd->pd->bl,0);
|
||||||
map_delblock(&sd->pd->bl);
|
map_delblock(&sd->pd->bl);
|
||||||
free(sd->pd->lootitem);
|
if (sd->pd->lootitem)
|
||||||
|
aFree(sd->pd->lootitem);
|
||||||
map_deliddb(&sd->pd->bl);
|
map_deliddb(&sd->pd->bl);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user