From 57659f010ea62e157d34d227b79d67f8d1b8b96b Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 12 Mar 2012 19:42:50 +0000 Subject: *nix compilation fix (for rev 402) git-svn-id: http://mc-server.googlecode.com/svn/trunk@405 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cEvent.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/cEvent.cpp b/source/cEvent.cpp index 17d56be91..cc476400f 100644 --- a/source/cEvent.cpp +++ b/source/cEvent.cpp @@ -38,6 +38,12 @@ cEvent::cEvent(void) LOGERROR("cEvent: Cannot create event, errno = %i. Aborting server.", errno); abort(); } + // Unlink the semaphore immediately - it will continue to function but will not pollute the namespace + // We don't store the name, so can't call this in the destructor + if (sem_unlink(EventName.c_str()) != 0) + { + LOGWARN("ERROR: Could not unlink cEvent. (%i)", errno); + } } #endif // *nix } @@ -53,10 +59,6 @@ cEvent::~cEvent() #else if (m_bIsNamed) { - if (sem_unlink(EventName.c_str()) != 0) - { - LOGWARN("ERROR: Could not unlink cEvent. (%i)", errno); - } if (sem_close(m_Event) != 0) { LOGERROR("ERROR: Could not close cEvent. (%i)", errno); -- cgit v1.2.3