Using predefined constants as parameters to the exit() function.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11501 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-10-17 17:20:01 +00:00
parent 6c04229cb6
commit 3d7a129b90
26 changed files with 66 additions and 66 deletions

View File

@ -1003,7 +1003,7 @@ int mmo_char_init(void)
if (!char_dat) { if (!char_dat) {
ShowFatalError("Out of memory: mmo_char_init (realloc of char_dat).\n"); ShowFatalError("Out of memory: mmo_char_init (realloc of char_dat).\n");
char_log("Out of memory: mmo_char_init (realloc of char_dat).\n"); char_log("Out of memory: mmo_char_init (realloc of char_dat).\n");
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -1227,7 +1227,7 @@ int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, i
if (!char_dat) { if (!char_dat) {
ShowFatalError("Out of memory: make_new_char (realloc of char_dat).\n"); ShowFatalError("Out of memory: make_new_char (realloc of char_dat).\n");
char_log("Out of memory: make_new_char (realloc of char_dat).\n"); char_log("Out of memory: make_new_char (realloc of char_dat).\n");
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -1993,7 +1993,7 @@ int parse_fromlogin(int fd)
ShowError("The server communication passwords (default s1/p1) are probably invalid.\n"); ShowError("The server communication passwords (default s1/p1) are probably invalid.\n");
ShowInfo("Also, please make sure your accounts file (default: accounts.txt) has those values present.\n"); ShowInfo("Also, please make sure your accounts file (default: accounts.txt) has those values present.\n");
ShowInfo("The communication passwords can be changed in map_athena.conf and char_athena.conf\n"); ShowInfo("The communication passwords can be changed in map_athena.conf and char_athena.conf\n");
//exit(1); //fixed for server shutdown. //exit(EXIT_FAILURE); //fixed for server shutdown.
} else { } else {
ShowStatus("Connected to login-server (connection #%d).\n", fd); ShowStatus("Connected to login-server (connection #%d).\n", fd);

View File

@ -391,7 +391,7 @@ int inter_guild_init() {
g = (struct guild *) aCalloc(sizeof(struct guild), 1); g = (struct guild *) aCalloc(sizeof(struct guild), 1);
if(g == NULL){ if(g == NULL){
ShowFatalError("int_guild: out of memory!\n"); ShowFatalError("int_guild: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
// memset(g, 0, sizeof(struct guild)); not needed... // memset(g, 0, sizeof(struct guild)); not needed...
if (inter_guild_fromstr(line, g) == 0 && g->guild_id > 0) { if (inter_guild_fromstr(line, g) == 0 && g->guild_id > 0) {
@ -420,7 +420,7 @@ int inter_guild_init() {
gc = (struct guild_castle *) aCalloc(sizeof(struct guild_castle), 1); gc = (struct guild_castle *) aCalloc(sizeof(struct guild_castle), 1);
if(gc == NULL){ if(gc == NULL){
ShowFatalError("int_guild: out of memory!\n"); ShowFatalError("int_guild: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
// memset(gc, 0, sizeof(struct guild_castle)); No need... // memset(gc, 0, sizeof(struct guild_castle)); No need...
if (inter_guildcastle_fromstr(line, gc) == 0) { if (inter_guildcastle_fromstr(line, gc) == 0) {
@ -439,7 +439,7 @@ int inter_guild_init() {
gc = (struct guild_castle *) aCalloc(sizeof(struct guild_castle), 1); gc = (struct guild_castle *) aCalloc(sizeof(struct guild_castle), 1);
if (gc == NULL) { if (gc == NULL) {
ShowFatalError("int_guild: out of memory!\n"); ShowFatalError("int_guild: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
gc->castle_id = i; gc->castle_id = i;
idb_put(castle_db, gc->castle_id, gc); idb_put(castle_db, gc->castle_id, gc);
@ -979,7 +979,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem
if (g == NULL) { if (g == NULL) {
ShowFatalError("int_guild: CreateGuild: out of memory !\n"); ShowFatalError("int_guild: CreateGuild: out of memory !\n");
mapif_guild_created(fd, account_id, NULL); mapif_guild_created(fd, account_id, NULL);
exit(0); exit(EXIT_FAILURE);
} }
// memset(g, 0, sizeof(struct guild)); Meh... // memset(g, 0, sizeof(struct guild)); Meh...
g->guild_id = guild_newid++; g->guild_id = guild_newid++;

View File

@ -127,7 +127,7 @@ int inter_homun_init()
p = (struct s_homunculus*)aCalloc(sizeof(struct s_homunculus), 1); p = (struct s_homunculus*)aCalloc(sizeof(struct s_homunculus), 1);
if(p==NULL){ if(p==NULL){
ShowFatalError("int_homun: out of memory!\n"); ShowFatalError("int_homun: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
if(inter_homun_fromstr(line,p)==0 && p->hom_id>0){ if(inter_homun_fromstr(line,p)==0 && p->hom_id>0){
if( p->hom_id >= homun_newid) if( p->hom_id >= homun_newid)

View File

@ -194,7 +194,7 @@ int inter_party_init() {
p = (struct party_data*)aCalloc(sizeof(struct party_data), 1); p = (struct party_data*)aCalloc(sizeof(struct party_data), 1);
if (p == NULL){ if (p == NULL){
ShowFatalError("int_party: out of memory!\n"); ShowFatalError("int_party: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
memset(p, 0, sizeof(struct party_data)); memset(p, 0, sizeof(struct party_data));
if (inter_party_fromstr(line, &p->party) == 0 && p->party.party_id > 0) { if (inter_party_fromstr(line, &p->party) == 0 && p->party.party_id > 0) {

View File

@ -97,7 +97,7 @@ int inter_pet_init()
p = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1); p = (struct s_pet*)aCalloc(sizeof(struct s_pet), 1);
if(p==NULL){ if(p==NULL){
ShowFatalError("int_pet: out of memory!\n"); ShowFatalError("int_pet: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
memset(p,0,sizeof(struct s_pet)); memset(p,0,sizeof(struct s_pet));
if(inter_pet_fromstr(line,p)==0 && p->pet_id>0){ if(inter_pet_fromstr(line,p)==0 && p->pet_id>0){

View File

@ -211,7 +211,7 @@ int inter_storage_init()
s = (struct storage*)aCalloc(sizeof(struct storage), 1); s = (struct storage*)aCalloc(sizeof(struct storage), 1);
if(s==NULL){ if(s==NULL){
ShowFatalError("int_storage: out of memory!\n"); ShowFatalError("int_storage: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
// memset(s,0,sizeof(struct storage)); aCalloc does this... // memset(s,0,sizeof(struct storage)); aCalloc does this...
s->account_id=tmp_int; s->account_id=tmp_int;
@ -240,7 +240,7 @@ int inter_storage_init()
gs = (struct guild_storage*)aCalloc(sizeof(struct guild_storage), 1); gs = (struct guild_storage*)aCalloc(sizeof(struct guild_storage), 1);
if(gs==NULL){ if(gs==NULL){
ShowFatalError("int_storage: out of memory!\n"); ShowFatalError("int_storage: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
// memset(gs,0,sizeof(struct guild_storage)); aCalloc... // memset(gs,0,sizeof(struct guild_storage)); aCalloc...
gs->guild_id=tmp_int; gs->guild_id=tmp_int;

View File

@ -118,7 +118,7 @@ int inter_accreg_init(void) {
reg = (struct accreg*)aCalloc(sizeof(struct accreg), 1); reg = (struct accreg*)aCalloc(sizeof(struct accreg), 1);
if (reg == NULL) { if (reg == NULL) {
ShowFatalError("inter: accreg: out of memory!\n"); ShowFatalError("inter: accreg: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
if (inter_accreg_fromstr(line, reg) == 0 && reg->account_id > 0) { if (inter_accreg_fromstr(line, reg) == 0 && reg->account_id > 0) {
idb_put(accreg_db, reg->account_id, reg); idb_put(accreg_db, reg->account_id, reg);

View File

@ -273,7 +273,7 @@ int inter_party_sql_init(void)
party_pt = (struct party_data*)aCalloc(sizeof(struct party_data), 1); party_pt = (struct party_data*)aCalloc(sizeof(struct party_data), 1);
if (!party_pt) { if (!party_pt) {
ShowFatalError("inter_party_sql_init: Out of Memory!\n"); ShowFatalError("inter_party_sql_init: Out of Memory!\n");
exit(1); exit(EXIT_FAILURE);
} }
/* Uncomment the following if you want to do a party_db cleanup (remove parties with no members) on startup.[Skotlex] /* Uncomment the following if you want to do a party_db cleanup (remove parties with no members) on startup.[Skotlex]

View File

@ -356,7 +356,7 @@ int inter_init_sql(const char *file)
{ {
Sql_ShowDebug(sql_handle); Sql_ShowDebug(sql_handle);
Sql_Free(sql_handle); Sql_Free(sql_handle);
exit(1); exit(EXIT_FAILURE);
} }
#ifndef TXT_SQL_CONVERT #ifndef TXT_SQL_CONVERT
else if (inter_sql_test()) { else if (inter_sql_test()) {
@ -371,7 +371,7 @@ int inter_init_sql(const char *file)
Sql_ShowDebug(lsql_handle); Sql_ShowDebug(lsql_handle);
Sql_Free(lsql_handle); Sql_Free(lsql_handle);
Sql_Free(sql_handle); Sql_Free(sql_handle);
exit(1); exit(EXIT_FAILURE);
} }
else else
{ {
@ -430,7 +430,7 @@ int inter_sql_test (void)
if( lsql_handle ) if( lsql_handle )
Sql_Free(lsql_handle); Sql_Free(lsql_handle);
Sql_Free(sql_handle); Sql_Free(sql_handle);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -78,7 +78,7 @@ static void sig_proc(int sn)
case SIGINT: case SIGINT:
case SIGTERM: case SIGTERM:
if (++is_called > 3) if (++is_called > 3)
exit(0); exit(EXIT_SUCCESS);
runflag = 0; runflag = 0;
break; break;
case SIGSEGV: case SIGSEGV:

View File

@ -566,7 +566,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn) - 1) { if (strlen(fname) > sizeof(aentry.fn) - 1) {
ShowFatalError("GRF file name %s is too long\n", fname); ShowFatalError("GRF file name %s is too long\n", fname);
aFree(grf_filelist); aFree(grf_filelist);
exit(1); exit(EXIT_FAILURE);
} }
srclen = 0; srclen = 0;
if ((period_ptr = strrchr(fname, '.')) != NULL) { if ((period_ptr = strrchr(fname, '.')) != NULL) {
@ -637,7 +637,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn)-1) { if (strlen(fname) > sizeof(aentry.fn)-1) {
ShowFatalError("GRF file name %s is too long\n", fname); ShowFatalError("GRF file name %s is too long\n", fname);
aFree(grf_filelist); aFree(grf_filelist);
exit(1); exit(EXIT_FAILURE);
} }
ofs2 = ofs + (int)strlen(fname)+1; ofs2 = ofs + (int)strlen(fname)+1;
type = grf_filelist[ofs2+12]; type = grf_filelist[ofs2+12];

View File

@ -18,7 +18,7 @@ void* aMalloc_(size_t size, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aMalloc %d\n",file,line,func,size); // ShowMessage("%s:%d: in func %s: aMalloc %d\n",file,line,func,size);
if (ret == NULL){ if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aMalloc error out of memory!\n",file,line,func); ShowFatalError("%s:%d: in func %s: aMalloc error out of memory!\n",file,line,func);
exit(1); exit(EXIT_FAILURE);
} }
return ret; return ret;
@ -29,7 +29,7 @@ void* aMallocA_(size_t size, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aMallocA %d\n",file,line,func,size); // ShowMessage("%s:%d: in func %s: aMallocA %d\n",file,line,func,size);
if (ret == NULL){ if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aMallocA error out of memory!\n",file,line,func); ShowFatalError("%s:%d: in func %s: aMallocA error out of memory!\n",file,line,func);
exit(1); exit(EXIT_FAILURE);
} }
return ret; return ret;
@ -40,7 +40,7 @@ void* aCalloc_(size_t num, size_t size, const char *file, int line, const char *
// ShowMessage("%s:%d: in func %s: aCalloc %d %d\n",file,line,func,num,size); // ShowMessage("%s:%d: in func %s: aCalloc %d %d\n",file,line,func,num,size);
if (ret == NULL){ if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aCalloc error out of memory!\n", file, line, func); ShowFatalError("%s:%d: in func %s: aCalloc error out of memory!\n", file, line, func);
exit(1); exit(EXIT_FAILURE);
} }
return ret; return ret;
} }
@ -50,7 +50,7 @@ void* aCallocA_(size_t num, size_t size, const char *file, int line, const char
// ShowMessage("%s:%d: in func %s: aCallocA %d %d\n",file,line,func,num,size); // ShowMessage("%s:%d: in func %s: aCallocA %d %d\n",file,line,func,num,size);
if (ret == NULL){ if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aCallocA error out of memory!\n",file,line,func); ShowFatalError("%s:%d: in func %s: aCallocA error out of memory!\n",file,line,func);
exit(1); exit(EXIT_FAILURE);
} }
return ret; return ret;
} }
@ -60,7 +60,7 @@ void* aRealloc_(void *p, size_t size, const char *file, int line, const char *fu
// ShowMessage("%s:%d: in func %s: aRealloc %p %d\n",file,line,func,p,size); // ShowMessage("%s:%d: in func %s: aRealloc %p %d\n",file,line,func,p,size);
if (ret == NULL){ if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aRealloc error out of memory!\n",file,line,func); ShowFatalError("%s:%d: in func %s: aRealloc error out of memory!\n",file,line,func);
exit(1); exit(EXIT_FAILURE);
} }
return ret; return ret;
} }
@ -70,7 +70,7 @@ char* aStrdup_(const char *p, const char *file, int line, const char *func)
// ShowMessage("%s:%d: in func %s: aStrdup %p\n",file,line,func,p); // ShowMessage("%s:%d: in func %s: aStrdup %p\n",file,line,func,p);
if (ret == NULL){ if (ret == NULL){
ShowFatalError("%s:%d: in func %s: aStrdup error out of memory!\n", file, line, func); ShowFatalError("%s:%d: in func %s: aStrdup error out of memory!\n", file, line, func);
exit(1); exit(EXIT_FAILURE);
} }
return ret; return ret;
} }
@ -227,7 +227,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
return (char *)p + sizeof(struct unit_head_large) - sizeof(int); return (char *)p + sizeof(struct unit_head_large) - sizeof(int);
} else { } else {
ShowFatalError("Memory manager::memmgr_alloc failed (allocating %d+%d bytes at %s:%d).\n", sizeof(struct unit_head_large), size, file, line); ShowFatalError("Memory manager::memmgr_alloc failed (allocating %d+%d bytes at %s:%d).\n", sizeof(struct unit_head_large), size, file, line);
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -288,7 +288,7 @@ void* _mmalloc(size_t size, const char *file, int line, const char *func )
// ここに来てはいけない。 // ここに来てはいけない。
ShowFatalError("Memory manager::memmgr_malloc() serious error (allocating %d+%d bytes at %s:%d)\n", sizeof(struct unit_head_large), size, file, line); ShowFatalError("Memory manager::memmgr_malloc() serious error (allocating %d+%d bytes at %s:%d)\n", sizeof(struct unit_head_large), size, file, line);
memmgr_info(); memmgr_info();
exit(1); exit(EXIT_FAILURE);
//return NULL; //return NULL;
}; };
@ -485,14 +485,14 @@ static struct block* block_malloc(void)
char *pb = (char *)CALLOC(sizeof(struct block),BLOCK_ALLOC+1,file,line,func); char *pb = (char *)CALLOC(sizeof(struct block),BLOCK_ALLOC+1,file,line,func);
if(pb == NULL) { if(pb == NULL) {
ShowFatalError("Memory manager::block_alloc failed.\n"); ShowFatalError("Memory manager::block_alloc failed.\n");
exit(1); exit(EXIT_FAILURE);
} }
// store original block address in chunk // store original block address in chunk
chunk = (struct chunk *)MALLOC(sizeof(struct chunk),file,line,func); chunk = (struct chunk *)MALLOC(sizeof(struct chunk),file,line,func);
if (chunk == NULL) { if (chunk == NULL) {
ShowFatalError("Memory manager::block_alloc failed.\n"); ShowFatalError("Memory manager::block_alloc failed.\n");
exit(1); exit(EXIT_FAILURE);
} }
chunk->block = pb; chunk->block = pb;
chunk->next = (chunk_first) ? chunk_first : NULL; chunk->next = (chunk_first) ? chunk_first : NULL;

View File

@ -150,7 +150,7 @@ void mapindex_init(void)
fp=fopen(mapindex_cfgfile,"r"); fp=fopen(mapindex_cfgfile,"r");
if(fp==NULL){ if(fp==NULL){
ShowFatalError("Unable to read mapindex config file %s!\n", mapindex_cfgfile); ShowFatalError("Unable to read mapindex config file %s!\n", mapindex_cfgfile);
exit(1); //Server can't really run without this file. exit(EXIT_FAILURE); //Server can't really run without this file.
} }
while(fgets(line, sizeof(line), fp)) while(fgets(line, sizeof(line), fp))
{ {

View File

@ -297,7 +297,7 @@ int make_listen_bind(uint32 ip, uint16 port)
if (fd == INVALID_SOCKET) { if (fd == INVALID_SOCKET) {
ShowError("socket() creation failed (code %d)!\n", s_errno); ShowError("socket() creation failed (code %d)!\n", s_errno);
exit(1); exit(EXIT_FAILURE);
} }
if ( fd >= FD_SETSIZE ) { //Not enough capacity for this socket if ( fd >= FD_SETSIZE ) { //Not enough capacity for this socket
@ -316,17 +316,17 @@ int make_listen_bind(uint32 ip, uint16 port)
result = bind(fd, (struct sockaddr*)&server_address, sizeof(server_address)); result = bind(fd, (struct sockaddr*)&server_address, sizeof(server_address));
if( result == SOCKET_ERROR ) { if( result == SOCKET_ERROR ) {
ShowError("bind failed (socket %d, code %d)!\n", fd, s_errno); ShowError("bind failed (socket %d, code %d)!\n", fd, s_errno);
exit(1); exit(EXIT_FAILURE);
} }
result = listen( fd, 5 ); result = listen( fd, 5 );
if( result == SOCKET_ERROR ) { if( result == SOCKET_ERROR ) {
ShowError("listen failed (socket %d, code %d)!\n", fd, s_errno); ShowError("listen failed (socket %d, code %d)!\n", fd, s_errno);
exit(1); exit(EXIT_FAILURE);
} }
if ( fd < 0 || fd > FD_SETSIZE ) if ( fd < 0 || fd > FD_SETSIZE )
{ //Crazy error that can happen in Windows? (info from Freya) { //Crazy error that can happen in Windows? (info from Freya)
ShowFatalError("listen() returned invalid fd %d!\n",fd); ShowFatalError("listen() returned invalid fd %d!\n",fd);
exit(1); exit(EXIT_FAILURE);
} }
if(fd_max <= fd) fd_max = fd + 1; if(fd_max <= fd) fd_max = fd + 1;
@ -469,7 +469,7 @@ int RFIFOSKIP(int fd, size_t len)
if ( s->rdata_size < s->rdata_pos + len ) { if ( s->rdata_size < s->rdata_pos + len ) {
//fprintf(stderr,"too many skip\n"); //fprintf(stderr,"too many skip\n");
//exit(1); //exit(EXIT_FAILURE);
//better than a COMPLETE program abort // TEST! :) //better than a COMPLETE program abort // TEST! :)
ShowError("too many skip (%d) now skipped: %d (FD: %d)\n", len, RFIFOREST(fd), fd); ShowError("too many skip (%d) now skipped: %d (FD: %d)\n", len, RFIFOREST(fd), fd);
len = RFIFOREST(fd); len = RFIFOREST(fd);
@ -494,7 +494,7 @@ int WFIFOSET(int fd, size_t len)
fd, CONVIP(ip), len, s->wdata_size, s->max_wdata); fd, CONVIP(ip), len, s->wdata_size, s->max_wdata);
ShowDebug("Likely command that caused it: 0x%x\n", (*(unsigned short*)(s->wdata + s->wdata_size))); ShowDebug("Likely command that caused it: 0x%x\n", (*(unsigned short*)(s->wdata + s->wdata_size)));
// no other chance, make a better fifo model // no other chance, make a better fifo model
exit(1); exit(EXIT_FAILURE);
} }
s->wdata_size += len; s->wdata_size += len;

View File

@ -3215,7 +3215,7 @@ int prompt(void)
} else { } else {
ShowMessage("Bye.\n"); ShowMessage("Bye.\n");
} }
exit(0); exit(EXIT_SUCCESS);
// unknown command // unknown command
} else { } else {
if (defaultlanguage == 'F') { if (defaultlanguage == 'F') {
@ -4199,7 +4199,7 @@ int Connect_login_server(void)
if (login_fd == -1) if (login_fd == -1)
{ //Might not be the most elegant way to handle this, but I've never used ladmin so I dunno what else you could do. [Skotlex] { //Might not be the most elegant way to handle this, but I've never used ladmin so I dunno what else you could do. [Skotlex]
ShowMessage("Error: Failed to connect to Login Server\n"); ShowMessage("Error: Failed to connect to Login Server\n");
exit(1); exit(EXIT_FAILURE);
} }
if (passenc == 0) { if (passenc == 0) {
WFIFOHEAD(login_fd,28); WFIFOHEAD(login_fd,28);

View File

@ -299,7 +299,7 @@ int mmo_auth_sqldb_init(void)
{ {
Sql_ShowDebug(sql_handle); Sql_ShowDebug(sql_handle);
Sql_Free(sql_handle); Sql_Free(sql_handle);
exit(1); exit(EXIT_FAILURE);
} }
else else
{ {

View File

@ -343,7 +343,7 @@ int chrif_connectack(int fd)
{ {
if (RFIFOB(fd,2)) { if (RFIFOB(fd,2)) {
ShowFatalError("Connection to char-server failed %d.\n", RFIFOB(fd,2)); ShowFatalError("Connection to char-server failed %d.\n", RFIFOB(fd,2));
exit(1); exit(EXIT_FAILURE);
} }
ShowStatus("Successfully logged on to Char Server (Connection: '"CL_WHITE"%d"CL_RESET"').\n",fd); ShowStatus("Successfully logged on to Char Server (Connection: '"CL_WHITE"%d"CL_RESET"').\n",fd);
chrif_state = 1; chrif_state = 1;
@ -368,7 +368,7 @@ int chrif_sendmapack(int fd)
{ {
if (RFIFOB(fd,2)) { if (RFIFOB(fd,2)) {
ShowFatalError("chrif : send map list to char server failed %d\n", RFIFOB(fd,2)); ShowFatalError("chrif : send map list to char server failed %d\n", RFIFOB(fd,2));
exit(1); exit(EXIT_FAILURE);
} }
memcpy(wisp_server_name, RFIFOP(fd,3), NAME_LENGTH); memcpy(wisp_server_name, RFIFOP(fd,3), NAME_LENGTH);

View File

@ -11776,7 +11776,7 @@ static int packetdb_readdb(void)
sprintf(line, "%s/packet_db.txt", db_path); sprintf(line, "%s/packet_db.txt", db_path);
if( (fp=fopen(line,"r"))==NULL ){ if( (fp=fopen(line,"r"))==NULL ){
ShowFatalError("can't read %s\n", line); ShowFatalError("can't read %s\n", line);
exit(1); exit(EXIT_FAILURE);
} }
clif_config.packet_db_ver = MAX_PACKET_VER; clif_config.packet_db_ver = MAX_PACKET_VER;
@ -11886,7 +11886,7 @@ static int packetdb_readdb(void)
if(str[3]==NULL){ if(str[3]==NULL){
ShowError("packet_db: packet error\n"); ShowError("packet_db: packet error\n");
exit(1); exit(EXIT_FAILURE);
} }
for(j=0,p2=str[3];p2;j++){ for(j=0,p2=str[3];p2;j++){
str2[j]=p2; str2[j]=p2;
@ -11928,7 +11928,7 @@ int do_init_clif(void)
set_defaultparse(clif_parse); set_defaultparse(clif_parse);
if (!make_listen_bind(bind_ip,map_port)) { if (!make_listen_bind(bind_ip,map_port)) {
ShowFatalError("can't bind game port\n"); ShowFatalError("can't bind game port\n");
exit(1); exit(EXIT_FAILURE);
} }
add_timer_func_list(clif_waitclose, "clif_waitclose"); add_timer_func_list(clif_waitclose, "clif_waitclose");

View File

@ -2394,7 +2394,7 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
if(ip == clif_getip() && port == clif_getport()) { if(ip == clif_getip() && port == clif_getport()) {
//That's odd, we received info that we are the ones with this map, but... we don't have it. //That's odd, we received info that we are the ones with this map, but... we don't have it.
ShowFatalError("map_setipport : received info that this map-server SHOULD have map '%s', but it is not loaded.\n",mapindex_id2name(mapindex)); ShowFatalError("map_setipport : received info that this map-server SHOULD have map '%s', but it is not loaded.\n",mapindex_id2name(mapindex));
exit(1); exit(EXIT_FAILURE);
} }
mdos->ip = ip; mdos->ip = ip;
mdos->port = port; mdos->port = port;
@ -2606,7 +2606,7 @@ int map_readallmaps (void)
if( (fp = fopen(map_cache_file, "rb")) == NULL ) if( (fp = fopen(map_cache_file, "rb")) == NULL )
{ {
ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", map_cache_file); ShowFatalError("Unable to open map cache file "CL_WHITE"%s"CL_RESET"\n", map_cache_file);
exit(1); //No use launching server if maps can't be read. exit(EXIT_FAILURE); //No use launching server if maps can't be read.
} }
} }
@ -2961,7 +2961,7 @@ int map_sql_init(void)
ShowInfo("Connecting to the Map DB Server....\n"); ShowInfo("Connecting to the Map DB Server....\n");
if( SQL_ERROR == Sql_Connect(mmysql_handle, map_server_id, map_server_pw, map_server_ip, map_server_port, map_server_db) ) if( SQL_ERROR == Sql_Connect(mmysql_handle, map_server_id, map_server_pw, map_server_ip, map_server_port, map_server_db) )
exit(1); exit(EXIT_FAILURE);
ShowStatus("connect success! (Map Server Connection)\n"); ShowStatus("connect success! (Map Server Connection)\n");
if( strlen(default_codepage) > 0 ) if( strlen(default_codepage) > 0 )
@ -2975,7 +2975,7 @@ int map_sql_init(void)
ShowInfo("Connecting to the Mail DB Server....\n"); ShowInfo("Connecting to the Mail DB Server....\n");
if( SQL_ERROR == Sql_Connect(mail_handle, mail_server_id, mail_server_pw, mail_server_ip, mail_server_port, mail_server_db) ) if( SQL_ERROR == Sql_Connect(mail_handle, mail_server_id, mail_server_pw, mail_server_ip, mail_server_port, mail_server_db) )
exit(1); exit(EXIT_FAILURE);
if( strlen(default_codepage) > 0 ) if( strlen(default_codepage) > 0 )
if ( SQL_ERROR == Sql_SetEncoding(mail_handle, default_codepage) ) if ( SQL_ERROR == Sql_SetEncoding(mail_handle, default_codepage) )
@ -3015,7 +3015,7 @@ int log_sql_init(void)
ShowInfo(""CL_WHITE"[SQL]"CL_RESET": Connecting to the Log Database "CL_WHITE"%s"CL_RESET" At "CL_WHITE"%s"CL_RESET"...\n",log_db,log_db_ip); ShowInfo(""CL_WHITE"[SQL]"CL_RESET": Connecting to the Log Database "CL_WHITE"%s"CL_RESET" At "CL_WHITE"%s"CL_RESET"...\n",log_db,log_db_ip);
if ( SQL_ERROR == Sql_Connect(logmysql_handle, log_db_id, log_db_pw, log_db_ip, log_db_port, log_db) ) if ( SQL_ERROR == Sql_Connect(logmysql_handle, log_db_id, log_db_pw, log_db_ip, log_db_port, log_db) )
exit(1); exit(EXIT_FAILURE);
ShowStatus(""CL_WHITE"[SQL]"CL_RESET": Successfully '"CL_GREEN"connected"CL_RESET"' to Database '"CL_WHITE"%s"CL_RESET"'.\n", log_db); ShowStatus(""CL_WHITE"[SQL]"CL_RESET": Successfully '"CL_GREEN"connected"CL_RESET"' to Database '"CL_WHITE"%s"CL_RESET"'.\n", log_db);
if( strlen(default_codepage) > 0 ) if( strlen(default_codepage) > 0 )
@ -3269,7 +3269,7 @@ void map_helpscreen(int flag)
puts(" (SQL Only)"); puts(" (SQL Only)");
puts(" --version, --v, -v, /v Displays the server's version"); puts(" --version, --v, -v, /v Displays the server's version");
puts("\n"); puts("\n");
if (flag) exit(1); if (flag) exit(EXIT_FAILURE);
} }
/*====================================================== /*======================================================
@ -3285,7 +3285,7 @@ void map_versionscreen(int flag)
puts(CL_GREEN "IRC Channel:" CL_RESET "\tirc://irc.deltaanime.net/#athena"); puts(CL_GREEN "IRC Channel:" CL_RESET "\tirc://irc.deltaanime.net/#athena");
puts("\nOpen " CL_WHITE "readme.html" CL_RESET " for more information."); puts("\nOpen " CL_WHITE "readme.html" CL_RESET " for more information.");
if (ATHENA_RELEASE_FLAG) ShowNotice("This version is not for release.\n"); if (ATHENA_RELEASE_FLAG) ShowNotice("This version is not for release.\n");
if (flag) exit(1); if (flag) exit(EXIT_FAILURE);
} }
/*====================================================== /*======================================================

View File

@ -201,10 +201,10 @@ int npc_event_export(char* lname, void* data, va_list ap)
ev = (struct event_data *) aMalloc(sizeof(struct event_data)); ev = (struct event_data *) aMalloc(sizeof(struct event_data));
if (ev==NULL) { if (ev==NULL) {
ShowFatalError("npc_event_export: out of memory !\n"); ShowFatalError("npc_event_export: out of memory !\n");
exit(1); exit(EXIT_FAILURE);
}else if (p==NULL || (p-lname)>NAME_LENGTH) { }else if (p==NULL || (p-lname)>NAME_LENGTH) {
ShowFatalError("npc_event_export: label name error !\n"); ShowFatalError("npc_event_export: label name error !\n");
exit(1); exit(EXIT_FAILURE);
}else{ }else{
ev->nd = nd; ev->nd = nd;
ev->pos = pos; ev->pos = pos;
@ -371,7 +371,7 @@ int npc_timerevent_import(char* lname, void* data, va_list ap)
else te= (struct npc_timerevent_list*)aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) ); else te= (struct npc_timerevent_list*)aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) );
if(te==NULL){ if(te==NULL){
ShowFatalError("npc_timerevent_import: out of memory !\n"); ShowFatalError("npc_timerevent_import: out of memory !\n");
exit(1); exit(EXIT_FAILURE);
} }
for(j=0;j<i;j++){ for(j=0;j<i;j++){
if(te[j].timer>t){ if(te[j].timer>t){
@ -1604,7 +1604,7 @@ int npc_convertlabel_db(DBKey key, void* data, va_list ap)
// here we check if the label fit into the buffer // here we check if the label fit into the buffer
if (len > 23) { if (len > 23) {
ShowError("npc_parse_script: label name longer than 23 chars! '%s'\n (%s)", lname, current_file); ShowError("npc_parse_script: label name longer than 23 chars! '%s'\n (%s)", lname, current_file);
exit(1); exit(EXIT_FAILURE);
} }
safestrncpy(lst[num].name, lname, NAME_LENGTH); safestrncpy(lst[num].name, lname, NAME_LENGTH);
lst[num].pos = pos; lst[num].pos = pos;
@ -1658,7 +1658,7 @@ static void npc_parse_script_line(char* p, int* curly_count, int line)
} }
if(string_flag) { if(string_flag) {
printf("Missing '\"' at file %s line %d\n", current_file, line); printf("Missing '\"' at file %s line %d\n", current_file, line);
exit(1); exit(EXIT_FAILURE);
} }
} }

View File

@ -121,7 +121,7 @@ int party_created(int account_id,int char_id,int fail,int party_id,char *name)
sd->status.party_id=party_id; sd->status.party_id=party_id;
if(idb_get(party_db,party_id)!=NULL){ if(idb_get(party_db,party_id)!=NULL){
ShowFatalError("party: id already exists!\n"); ShowFatalError("party: id already exists!\n");
exit(1); exit(EXIT_FAILURE);
} }
p=(struct party_data *)aCalloc(1,sizeof(struct party_data)); p=(struct party_data *)aCalloc(1,sizeof(struct party_data));
p->party.party_id=party_id; p->party.party_id=party_id;

View File

@ -59,7 +59,7 @@ static void update_heap_path(int *heap,struct tmp_path *tp,int index)
if( h == heap[0] ) if( h == heap[0] )
{ {
ShowError("update_heap_path bug\n"); ShowError("update_heap_path bug\n");
exit(1); exit(EXIT_FAILURE);
} }
for( i = (h-1)/2; h > 0 && tp[index].cost < tp[heap[i+1]].cost; i = (h-1)/2 ) for( i = (h-1)/2; h > 0 && tp[index].cost < tp[heap[i+1]].cost; i = (h-1)/2 )

View File

@ -5946,7 +5946,7 @@ int pc_setregstr(struct map_session_data *sd,int reg,char *str)
sd->regstr = (struct script_regstr *) aRealloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num); sd->regstr = (struct script_regstr *) aRealloc(sd->regstr, sizeof(sd->regstr[0]) * sd->regstr_num);
if(sd->regstr==NULL){ if(sd->regstr==NULL){
ShowFatalError("out of memory : pc_setreg\n"); ShowFatalError("out of memory : pc_setreg\n");
exit(1); exit(EXIT_FAILURE);
} }
memset(sd->regstr + (sd->regstr_num - 1), 0, sizeof(struct script_regstr)); memset(sd->regstr + (sd->regstr_num - 1), 0, sizeof(struct script_regstr));
sd->regstr[i].index = reg; sd->regstr[i].index = reg;

View File

@ -570,7 +570,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn) - 1) { if (strlen(fname) > sizeof(aentry.fn) - 1) {
printf("GRF file name %s is too long\n", fname); printf("GRF file name %s is too long\n", fname);
free(grf_filelist); free(grf_filelist);
exit(1); exit(EXIT_FAILURE);
} }
srclen = 0; srclen = 0;
if ((period_ptr = strrchr(fname, '.')) != NULL) { if ((period_ptr = strrchr(fname, '.')) != NULL) {
@ -641,7 +641,7 @@ static int grfio_entryread(char* grfname, int gentry)
if (strlen(fname) > sizeof(aentry.fn)-1) { if (strlen(fname) > sizeof(aentry.fn)-1) {
printf("GRF file name %s is too long\n", fname); printf("GRF file name %s is too long\n", fname);
free(grf_filelist); free(grf_filelist);
exit(1); exit(EXIT_FAILURE);
} }
ofs2 = ofs + (int)strlen(fname)+1; ofs2 = ofs + (int)strlen(fname)+1;
type = grf_filelist[ofs2+12]; type = grf_filelist[ofs2+12];

View File

@ -274,7 +274,7 @@ int main(int argc, char *argv[])
map_cache_fp = fopen(map_cache_file, "r+b"); map_cache_fp = fopen(map_cache_file, "r+b");
if(map_cache_fp == NULL) { if(map_cache_fp == NULL) {
printf("Failure when opening map cache file %s\n", map_cache_file); printf("Failure when opening map cache file %s\n", map_cache_file);
exit(1); exit(EXIT_FAILURE);
} }
// Open the map list // Open the map list
@ -282,7 +282,7 @@ int main(int argc, char *argv[])
list = fopen(map_list_file, "r"); list = fopen(map_list_file, "r");
if(list == NULL) { if(list == NULL) {
printf("Failure when opening maps list file %s\n", map_list_file); printf("Failure when opening maps list file %s\n", map_list_file);
exit(2); exit(EXIT_FAILURE);
} }
// Initialize the main header // Initialize the main header

View File

@ -63,7 +63,7 @@ int read_gm_account()
p = (struct gm_account*)malloc(sizeof(struct gm_account)); p = (struct gm_account*)malloc(sizeof(struct gm_account));
if(p==NULL){ if(p==NULL){
ShowFatalError("gm_account: out of memory!\n"); ShowFatalError("gm_account: out of memory!\n");
exit(0); exit(EXIT_FAILURE);
} }
if(sscanf(line,"%d %d",&p->account_id,&p->level) != 2 || p->level <= 0) { if(sscanf(line,"%d %d",&p->account_id,&p->level) != 2 || p->level <= 0) {
@ -101,7 +101,7 @@ int convert_login(void)
{ {
Sql_ShowDebug(mysql_handle); Sql_ShowDebug(mysql_handle);
Sql_Free(mysql_handle); Sql_Free(mysql_handle);
exit(1); exit(EXIT_FAILURE);
} }
ShowStatus("Connect: Success!\n"); ShowStatus("Connect: Success!\n");