main: no need to re-determine lock_file; already setup by set_derived_cnf
authorFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 9 Nov 2015 13:20:21 +0000 (14:20 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 11 Nov 2015 16:09:26 +0000 (17:09 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/main.c

index d264a63..70fc78d 100644 (file)
@@ -431,23 +431,6 @@ int main(int argc, char *argv[]) {
 
   set_derived_cnf(olsr_cnf);
 
-  /*
-   * Establish file lock to prevent multiple instances
-   */
-  if (olsr_cnf->lock_file) {
-    strscpy(lock_file_name, olsr_cnf->lock_file, sizeof(lock_file_name));
-  } else {
-    size_t l;
-#ifdef DEFAULT_LOCKFILE_PREFIX
-    strscpy(lock_file_name, DEFAULT_LOCKFILE_PREFIX, sizeof(lock_file_name));
-#else /* DEFAULT_LOCKFILE_PREFIX */
-    strscpy(lock_file_name, conf_file_name, sizeof(lock_file_name));
-#endif /* DEFAULT_LOCKFILE_PREFIX */
-    l = strlen(lock_file_name);
-    snprintf(&lock_file_name[l], sizeof(lock_file_name) - l, "-ipv%d.lock",
-        olsr_cnf->ip_version == AF_INET ? 4 : 6);
-  }
-
   /*
    * Print configuration
    */
@@ -614,6 +597,7 @@ int main(int argc, char *argv[]) {
   /*
    * Create locking file for olsrd, will be cleared after olsrd exits
    */
+  strscpy(lock_file_name, olsr_cnf->lock_file, sizeof(lock_file_name));
   for (i=5; i>=0; i--) {
     OLSR_PRINTF(3, "Trying to get olsrd lock...\n");
     if (!olsr_cnf->host_emul && olsr_create_lock_file(i > 0) == 0) {