aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMemphiz <memphis@machzwo.de>2016-07-09 23:37:48 +0200
committerMemphiz <memphis@machzwo.de>2016-08-13 10:42:37 +0200
commit8447a661bdfbf398db43e342f7a9a8260d99f429 (patch)
tree4d009930f855a8adf14f5f5da00f9a5e5b8a016a /tools
parentc8a97f788a38b038d4431b532e5b967ee4b6e156 (diff)
[XBMCHelper] - ensure only one instance is started
Diffstat (limited to 'tools')
-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);