mirror of
https://github.com/EQEmu/Server.git
synced 2026-11-22 20:17:16 +00:00
Crash handler: don't hang on a corrupted heap; fix guild tribute names (#5130)
This commit is contained in:
1 parent
c9c8747ac9
commit
a572b03f56
9 files changed
+33
-10
No files matched your search
+14
-1
@@ -243,13 +243,26 @@ void set_exception_handler() {
|
||||
#include <unistd.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <signal.h>
|
||||
#ifdef __FreeBSD__
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
static volatile sig_atomic_t crash_in_progress = 0;
|
||||
|
||||
void print_trace()
|
||||
{
|
||||
// The dump below is not async-signal-safe (popen, malloc, logging). If the crash came from heap
|
||||
// corruption inside malloc, it can deadlock on the allocator lock and the process never exits, holding
|
||||
// its launcher slot. So: a second fault while dumping exits at once, and an alarm kills the process
|
||||
// if the dump has not finished in time.
|
||||
if (crash_in_progress) {
|
||||
_exit(1);
|
||||
}
|
||||
crash_in_progress = 1;
|
||||
signal(SIGALRM, SIG_DFL);
|
||||
alarm(60);
|
||||
|
||||
bool does_gdb_exist = Strings::Contains(Process::execute("gdb -v"), "GNU");
|
||||
if (!does_gdb_exist) {
|
||||
LogCrash(
|
||||
|
||||
@@ -85,7 +85,7 @@ void DatabaseUpdate::CheckDbUpdates()
|
||||
}
|
||||
|
||||
int custom_database_version = UpdateManifest(manifest_entries_custom, v.custom_database_version, b.custom_database_version);
|
||||
if (custom_database_version > v.server_database_version) {
|
||||
if (custom_database_version > v.custom_database_version) {
|
||||
LogInfo(
|
||||
"Updates ran successfully, setting database version to [{}] from [{}]",
|
||||
custom_database_version,
|
||||
|
||||
@@ -313,9 +313,9 @@ int8 EQ::ItemInstance::AvailableAugmentSlot(int32 augment_type) const
|
||||
return INVALID_INDEX;
|
||||
}
|
||||
|
||||
bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augment_type, uint8 slot) const
|
||||
bool EQ::ItemInstance::IsAugmentSlotAvailable(int32 augment_type, uint8 slot, bool allow_occupied) const
|
||||
{
|
||||
if (!m_item || !m_item->IsClassCommon() || GetItem(slot)) {
|
||||
if (!m_item || !m_item->IsClassCommon() || (!allow_occupied && GetItem(slot))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace EQ
|
||||
bool IsAugmentable() const;
|
||||
bool AvailableWearSlot(uint32 aug_wear_slots) const;
|
||||
int8 AvailableAugmentSlot(int32 augment_type) const;
|
||||
bool IsAugmentSlotAvailable(int32 augment_type, uint8 slot) const;
|
||||
bool IsAugmentSlotAvailable(int32 augment_type, uint8 slot, bool allow_occupied = false) const;
|
||||
inline int GetAugmentType() const { return m_item ? m_item->AugType : 0; }
|
||||
inline uint32 GetAugmentRestriction() const { return m_item ? m_item->AugRestrict : 0; }
|
||||
|
||||
|
||||
@@ -3221,8 +3221,10 @@ void Client::Handle_OP_AugmentItem(const EQApplicationPacket *app)
|
||||
break;
|
||||
}
|
||||
|
||||
// a swap targets a filled slot; the old augment comes out below
|
||||
const bool is_swap = in_augment->augment_action == AugmentActions::Swap;
|
||||
if (
|
||||
tobe_auged->IsAugmentSlotAvailable(new_aug->GetAugmentType(), static_cast<uint8>(in_augment->augment_index)) &&
|
||||
tobe_auged->IsAugmentSlotAvailable(new_aug->GetAugmentType(), static_cast<uint8>(in_augment->augment_index), is_swap) &&
|
||||
tobe_auged->AvailableWearSlot(new_aug->GetItem()->Slots)
|
||||
) {
|
||||
old_aug = tobe_auged->RemoveAugment(static_cast<uint8>(in_augment->augment_index));
|
||||
@@ -11861,6 +11863,9 @@ void Client::Handle_OP_PetitionCheckIn(const EQApplicationPacket *app)
|
||||
Petition_Struct* inpet = (Petition_Struct*)app->pBuffer;
|
||||
|
||||
Petition* pet = PetitionList::Instance()->GetPetitionByID(inpet->petnumber);
|
||||
if (!pet) {
|
||||
return;
|
||||
}
|
||||
//if (inpet->urgency != pet->GetUrgency())
|
||||
pet->SetUrgency(inpet->urgency);
|
||||
pet->SetLastGM(GetName());
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@
|
||||
#define DISARMED_TRAP 305 //You have disarmed the trap.
|
||||
#define LDON_SENSE_TRAP1 306 //You do not Sense any traps.
|
||||
#define TRADESKILL_NOCOMBINE 334 //You cannot combine these items in this container type!
|
||||
#define TRADESKILL_FAILED 336 //You lacked the skills to fashion the items together. // TODO: TOB - 336 You lacked the skills to fashion %1.
|
||||
#define TRADESKILL_FAILED 336 //You lacked the skills to fashion the items together. (ToB: ...to fashion %1.)
|
||||
#define TRADESKILL_TRIVIAL 338 //You can no longer advance your skill from making this item.
|
||||
#define TRADESKILL_SUCCEED 339 //You have fashioned the items together to create something new! // TODO: TOB - 339 You have %2fashioned the items together to create something new: %1.
|
||||
#define EVADE_SUCCESS 343 //You have momentarily ducked away from the main combat.
|
||||
|
||||
@@ -1199,7 +1199,12 @@ bool Client::TradeskillExecute(DBTradeskillRecipe_Struct *spec) {
|
||||
if(over_trivial < 0)
|
||||
CheckIncreaseTradeskill(bonusstat, stat_modifier, skillup_modifier, success_modifier, spec->tradeskill);
|
||||
|
||||
MessageString(Chat::Emote,TRADESKILL_FAILED);
|
||||
// ToB's text names the recipe (%1); the argument overload sends Emote as type 4, so older clients keep the plain one
|
||||
if (ClientVersion() >= EQ::versions::ClientVersion::TOB) {
|
||||
MessageString(Chat::Emote, TRADESKILL_FAILED, spec->name.c_str());
|
||||
} else {
|
||||
MessageString(Chat::Emote, TRADESKILL_FAILED);
|
||||
}
|
||||
|
||||
LogTradeskills("Tradeskill failed");
|
||||
if (GetGroup())
|
||||
|
||||
+1
-1
@@ -396,7 +396,7 @@ void Client::SendGuildTributes()
|
||||
gtas->ability.tiers[ti].tribute_item_id = htonl(t.second.tiers[ti].tribute_item_id);
|
||||
gtas->ability.tiers[ti].level = htonl(t.second.tiers[ti].level);
|
||||
}
|
||||
strn0cpy(gtas->ability.name, t.second.name.data(), t.second.name.length());
|
||||
strn0cpy(gtas->ability.name, t.second.name.data(), len);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -871,7 +871,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
ServerMultiLineMsg_Struct* mlm = (ServerMultiLineMsg_Struct*)pack->pBuffer;
|
||||
Client* client = entity_list.GetClientByName(mlm->to);
|
||||
if (client) {
|
||||
auto outapp = new EQApplicationPacket(OP_MultiLineMsg, strlen(mlm->message));
|
||||
auto outapp = new EQApplicationPacket(OP_MultiLineMsg, strlen(mlm->message) + 1);
|
||||
strcpy((char*)outapp->pBuffer, mlm->message);
|
||||
client->QueuePacket(outapp);
|
||||
safe_delete(outapp);
|
||||
|
||||
Reference in new issue
Block a user