]> skyeroc.xyz Git - dgamelaunch/commitdiff
lockfile is global, not per-game variable
authorPasi Kallinen <paxed@alt.org>
Sat, 31 Mar 2007 21:29:45 +0000 (21:29 +0000)
committerPasi Kallinen <paxed@alt.org>
Sat, 31 Mar 2007 21:29:45 +0000 (21:29 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@352 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

config.y
dgamelaunch.c
dgamelaunch.h
dgl-common.c

index bd8137427d5727e8cc09065383e37fd681c58311..6b5aa3ac7b0a561c28d9b7ee6dded041507bb893 100644 (file)
--- a/config.y
+++ b/config.y
@@ -165,8 +165,8 @@ KeyPair: KeyType '=' TYPE_VALUE {
       break;
 
     case TYPE_PATH_LOCKFILE:
-      if (myconfig[ncnf]->lockfile) free (myconfig[ncnf]->lockfile);
-      myconfig[ncnf]->lockfile = strdup($3);
+      if (globalconfig.lockfile) free (globalconfig.lockfile);
+      globalconfig.lockfile = strdup($3);
       break;
 
     case TYPE_PATH_PASSWD:
index a2534806d366d60b2dc8ef6a7cb2833150d95426..13a7678092614f2a4fc97b8af3cc18e30d0965db 100644 (file)
@@ -1101,7 +1101,7 @@ readfile (int nolock)
 
   if (!nolock)
     {
-      fpl = fopen (myconfig[0]->lockfile, "r");
+      fpl = fopen (globalconfig.lockfile, "r");
       if (!fpl)
         graceful_exit (106);
       if (fcntl (fileno (fpl), F_SETLKW, &fl) == -1)
@@ -1314,7 +1314,7 @@ writefile (int requirenew)
   sigaddset(&toblock, SIGTERM);
   sigprocmask(SIG_BLOCK, &toblock, &oldmask);
 
-  fpl = fopen (myconfig[0]->lockfile, "r+");
+  fpl = fopen (globalconfig.lockfile, "r+");
   if (!fpl)
     {
       sigprocmask(SIG_SETMASK, &oldmask, NULL);
@@ -1971,7 +1971,7 @@ main (int argc, char** argv)
   printf("gamepath:'%s'\n", myconfig[userchoice]->game_path);
   printf("game:'%s'\n", myconfig[userchoice]->game_name);
   printf("dglroot:'%s'\n", globalconfig.dglroot);
-  printf("lockfile:'%s'\n", myconfig[userchoice]->lockfile);
+  printf("lockfile:'%s'\n", globalconfig.lockfile);
   printf("passwd:'%s'\n", globalconfig.passwd);
   printf("banner:'%s'\n", globalconfig.banner);
   printf("rcfile:'%s'\n", myconfig[userchoice]->rcfile);
index 7318daa1983319ce1877dc9eb15c5bacf4b47a76..234e93ff92dfc2fad274768bf601a8e06433d60f 100644 (file)
@@ -46,7 +46,6 @@ struct dg_config
   char* game_path;
   char* game_name;
   char* chdir;
-  char* lockfile;
   char* rcfile;
   char* spool;
   char* savefilefmt;
@@ -68,6 +67,7 @@ struct dg_globalconfig
     uid_t shed_uid;
     gid_t shed_gid;
     char* passwd;
+    char* lockfile;
 };
 
 /* Global variables */
index d7d27942b06aa1482e04ff24b78eb9e12081530b..f66ae2a56727fe5ff35aed28590c21d424fc1146 100644 (file)
@@ -23,7 +23,7 @@ struct dg_config defconfig = {
   /* game_name = */ "NetHack",
   /* chdir = */ NULL,
   /* dglroot = *//*  "/dgldir/",*/
-  /* lockfile = */ "/dgl-lock",
+  /* lockfile = */ /*"/dgl-lock",*/
   /* passwd = */ /*"/dgl-login",*/
   /* banner = */ /*"/dgl-banner",*/
   /* rcfile = */ NULL, /*"/dgl-default-rcfile",*/
@@ -328,7 +328,6 @@ create_config ()
       if (!myconfig[tmp]->game_name) myconfig[tmp]->game_name = defconfig.game_name;
       if (!myconfig[tmp]->rcfile) myconfig[tmp]->rcfile = defconfig.rcfile;
       if (!myconfig[tmp]->spool) myconfig[tmp]->spool = defconfig.spool;
-      if (!myconfig[tmp]->lockfile) myconfig[tmp]->lockfile = defconfig.lockfile;
       if (!myconfig[tmp]->savefilefmt) myconfig[tmp]->savefilefmt = defconfig.savefilefmt;
       if (!myconfig[tmp]->inprogressdir) myconfig[tmp]->inprogressdir = defconfig.inprogressdir;
 
@@ -342,7 +341,7 @@ create_config ()
   if (!globalconfig.banner)  globalconfig.banner = "/dgl-banner";
 
   if (!globalconfig.passwd) globalconfig.passwd = "/dgl-login";
-
+  if (!globalconfig.lockfile) globalconfig.lockfile = "/dgl-lock";
   if (!globalconfig.shed_user && globalconfig.shed_uid == (uid_t)-1)
          {
              struct passwd *pw;