Browse Source

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
ultramage 17 years ago
parent
commit
3d7a129b90

+ 3 - 3
src/char/char.c

@@ -1003,7 +1003,7 @@ int mmo_char_init(void)
 			if (!char_dat) {
 				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");
-				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) {
 			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");
-			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");
 				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");
-				//exit(1); //fixed for server shutdown.
+				//exit(EXIT_FAILURE); //fixed for server shutdown.
 			} else {
 				ShowStatus("Connected to login-server (connection #%d).\n", fd);
 				

+ 4 - 4
src/char/int_guild.c

@@ -391,7 +391,7 @@ int inter_guild_init() {
 		g = (struct guild *) aCalloc(sizeof(struct guild), 1);
 		if(g == NULL){
 			ShowFatalError("int_guild: out of memory!\n");
-			exit(0);
+			exit(EXIT_FAILURE);
 		}
 //		memset(g, 0, sizeof(struct guild)); not needed...
 		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);
 		if(gc == NULL){
 			ShowFatalError("int_guild: out of memory!\n");
-			exit(0);
+			exit(EXIT_FAILURE);
 		}
 //		memset(gc, 0, sizeof(struct guild_castle)); No need...
 		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);
 			if (gc == NULL) {
 				ShowFatalError("int_guild: out of memory!\n");
-				exit(0);
+				exit(EXIT_FAILURE);
 			}
 			gc->castle_id = i;
 			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) {
 		ShowFatalError("int_guild: CreateGuild: out of memory !\n");
 		mapif_guild_created(fd, account_id, NULL);
-		exit(0);
+		exit(EXIT_FAILURE);
 	}
 //	memset(g, 0, sizeof(struct guild)); Meh...
 	g->guild_id = guild_newid++;

+ 1 - 1
src/char/int_homun.c

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

+ 1 - 1
src/char/int_party.c

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

+ 1 - 1
src/char/int_pet.c

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

+ 2 - 2
src/char/int_storage.c

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

+ 1 - 1
src/char/inter.c

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

+ 1 - 1
src/char_sql/int_party.c

@@ -273,7 +273,7 @@ int inter_party_sql_init(void)
 	party_pt = (struct party_data*)aCalloc(sizeof(struct party_data), 1);
 	if (!party_pt) {
 		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]

+ 3 - 3
src/char_sql/inter.c

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

+ 1 - 1
src/common/core.c

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

+ 2 - 2
src/common/grfio.c

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

+ 10 - 10
src/common/malloc.c

@@ -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);
 	if (ret == NULL){
 		ShowFatalError("%s:%d: in func %s: aMalloc error out of memory!\n",file,line,func);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 
 	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);
 	if (ret == NULL){
 		ShowFatalError("%s:%d: in func %s: aMallocA error out of memory!\n",file,line,func);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 
 	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);
 	if (ret == NULL){
 		ShowFatalError("%s:%d: in func %s: aCalloc error out of memory!\n", file, line, func);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	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);
 	if (ret == NULL){
 		ShowFatalError("%s:%d: in func %s: aCallocA error out of memory!\n",file,line,func);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	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);
 	if (ret == NULL){
 		ShowFatalError("%s:%d: in func %s: aRealloc error out of memory!\n",file,line,func);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	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);
 	if (ret == NULL){
 		ShowFatalError("%s:%d: in func %s: aStrdup error out of memory!\n", file, line, func);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	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);
 		} else {
 			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);
 	memmgr_info();
-	exit(1);
+	exit(EXIT_FAILURE);
 	//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);
 		if(pb == NULL) {
 			ShowFatalError("Memory manager::block_alloc failed.\n");
-			exit(1);
+			exit(EXIT_FAILURE);
 		}
 
 		// store original block address in chunk
 		chunk = (struct chunk *)MALLOC(sizeof(struct chunk),file,line,func);
 		if (chunk == NULL) {
 			ShowFatalError("Memory manager::block_alloc failed.\n");
-			exit(1);
+			exit(EXIT_FAILURE);
 		}
 		chunk->block = pb;
 		chunk->next = (chunk_first) ? chunk_first : NULL;

+ 1 - 1
src/common/mapindex.c

@@ -150,7 +150,7 @@ void mapindex_init(void)
 	fp=fopen(mapindex_cfgfile,"r");
 	if(fp==NULL){
 		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))
 	{

+ 6 - 6
src/common/socket.c

@@ -297,7 +297,7 @@ int make_listen_bind(uint32 ip, uint16 port)
 
 	if (fd == INVALID_SOCKET) {
 		ShowError("socket() creation failed (code %d)!\n", s_errno);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 
 	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));
 	if( result == SOCKET_ERROR ) {
 		ShowError("bind failed (socket %d, code %d)!\n", fd, s_errno);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	result = listen( fd, 5 );
 	if( result == SOCKET_ERROR ) {
 		ShowError("listen failed (socket %d, code %d)!\n", fd, s_errno);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	if ( fd < 0 || fd > FD_SETSIZE ) 
 	{ //Crazy error that can happen in Windows? (info from Freya)
 		ShowFatalError("listen() returned invalid fd %d!\n",fd);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 
 	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 ) {
 		//fprintf(stderr,"too many skip\n");
-		//exit(1);
+		//exit(EXIT_FAILURE);
 		//better than a COMPLETE program abort // TEST! :)
 		ShowError("too many skip (%d) now skipped: %d (FD: %d)\n", len, RFIFOREST(fd), 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);
 		ShowDebug("Likely command that caused it: 0x%x\n", (*(unsigned short*)(s->wdata + s->wdata_size)));
 		// no other chance, make a better fifo model
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 
 	s->wdata_size += len;

+ 2 - 2
src/ladmin/ladmin.c

@@ -3215,7 +3215,7 @@ int prompt(void)
 			} else {
 				ShowMessage("Bye.\n");
 			}
-			exit(0);
+			exit(EXIT_SUCCESS);
 // unknown command
 		} else {
 			if (defaultlanguage == 'F') {
@@ -4199,7 +4199,7 @@ int Connect_login_server(void)
 	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]
 		ShowMessage("Error: Failed to connect to Login Server\n");
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	if (passenc == 0) {
 		WFIFOHEAD(login_fd,28);

+ 1 - 1
src/login_sql/login.c

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

+ 2 - 2
src/map/chrif.c

@@ -343,7 +343,7 @@ int chrif_connectack(int fd)
 {
 	if (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);
 	chrif_state = 1;
@@ -368,7 +368,7 @@ int chrif_sendmapack(int fd)
 {
 	if (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);

+ 3 - 3
src/map/clif.c

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

+ 7 - 7
src/map/map.c

@@ -2394,7 +2394,7 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port)
 	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.
 		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->port = port;
@@ -2606,7 +2606,7 @@ int map_readallmaps (void)
 		if( (fp = fopen(map_cache_file, "rb")) == NULL )
 		{
 			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");
 	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");
 
 	if( strlen(default_codepage) > 0 )
@@ -2975,7 +2975,7 @@ int map_sql_init(void)
 
 		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) )
-			exit(1);
+			exit(EXIT_FAILURE);
 
 		if( strlen(default_codepage) > 0 )
 			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);
 	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);
 
 	if( strlen(default_codepage) > 0 )
@@ -3269,7 +3269,7 @@ void map_helpscreen(int flag)
 	puts("				(SQL Only)");
 	puts("  --version, --v, -v, /v	Displays the server's version");
 	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("\nOpen " CL_WHITE "readme.html" CL_RESET " for more information.");
 	if (ATHENA_RELEASE_FLAG) ShowNotice("This version is not for release.\n");
-	if (flag) exit(1);
+	if (flag) exit(EXIT_FAILURE);
 }
 
 /*======================================================

+ 5 - 5
src/map/npc.c

@@ -201,10 +201,10 @@ int npc_event_export(char* lname, void* data, va_list ap)
 		ev = (struct event_data *) aMalloc(sizeof(struct event_data));
 		if (ev==NULL) {
 			ShowFatalError("npc_event_export: out of memory !\n");
-			exit(1);
+			exit(EXIT_FAILURE);
 		}else if (p==NULL || (p-lname)>NAME_LENGTH) {
 			ShowFatalError("npc_event_export: label name error !\n");
-			exit(1);
+			exit(EXIT_FAILURE);
 		}else{
 			ev->nd = nd;
 			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) );
 		if(te==NULL){
 			ShowFatalError("npc_timerevent_import: out of memory !\n");
-			exit(1);
+			exit(EXIT_FAILURE);
 		}
 		for(j=0;j<i;j++){
 			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
 	if (len > 23) {
 		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);
 	lst[num].pos = pos;
@@ -1658,7 +1658,7 @@ static void npc_parse_script_line(char* p, int* curly_count, int line)
 	}
 	if(string_flag) {
 		printf("Missing '\"' at file %s line %d\n", current_file, line);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 }
 

+ 1 - 1
src/map/party.c

@@ -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;
 	if(idb_get(party_db,party_id)!=NULL){
 		ShowFatalError("party: id already exists!\n");
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	p=(struct party_data *)aCalloc(1,sizeof(struct party_data));
 	p->party.party_id=party_id;

+ 1 - 1
src/map/path.c

@@ -59,7 +59,7 @@ static void update_heap_path(int *heap,struct tmp_path *tp,int index)
 	if( h == heap[0] )
 	{
 		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 )

+ 1 - 1
src/map/pc.c

@@ -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);
 	if(sd->regstr==NULL){
 		ShowFatalError("out of memory : pc_setreg\n");
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	memset(sd->regstr + (sd->regstr_num - 1), 0, sizeof(struct script_regstr));
 	sd->regstr[i].index = reg;

+ 2 - 2
src/tool/grfio.c

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

+ 2 - 2
src/tool/mapcache.c

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

+ 2 - 2
src/txt-converter/login-converter.c

@@ -63,7 +63,7 @@ int read_gm_account()
 		p = (struct gm_account*)malloc(sizeof(struct gm_account));
 		if(p==NULL){
 			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) {
@@ -101,7 +101,7 @@ int convert_login(void)
 	{
 		Sql_ShowDebug(mysql_handle);
 		Sql_Free(mysql_handle);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 	ShowStatus("Connect: Success!\n");