aboutsummaryrefslogtreecommitdiff
path: root/tools/EventClients/Clients/OSXRemote
diff options
context:
space:
mode:
Diffstat (limited to 'tools/EventClients/Clients/OSXRemote')
-rw-r--r--tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm b/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm
index 5afb5ec6ab..2a4d8067ad 100644
--- a/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm
+++ b/tools/EventClients/Clients/OSXRemote/xbmchelper_main.mm
@@ -6,6 +6,7 @@
#include <sstream>
#include <fstream>
#include <iterator>
+#include <sys/file.h>
using namespace std;
@@ -214,6 +215,13 @@ void Reconfigure(int nSignal)
int main (int argc, char * argv[]) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+ int instanceLockFile = open("/tmp/xbmchelper.lock", O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
+ if (flock(instanceLockFile, LOCK_EX | LOCK_NB) != 0)
+ {
+ NSLog(@"Already running - exiting ...");
+ return 0;
+ }
+
ParseOptions(argc,argv);
NSLog(@"%s %s starting up...", PROGNAME, PROGVERS);