From d5636ad8443b673c0f5cb18a19516312a5e11696 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 31 Mar 2007 21:29:45 +0000 Subject: [PATCH] lockfile is global, not per-game variable git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@352 db0b04b0-f4d1-0310-9a6d-de3e77497b0e --- config.y | 4 ++-- dgamelaunch.c | 6 +++--- dgamelaunch.h | 2 +- dgl-common.c | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/config.y b/config.y index bd81374..6b5aa3a 100644 --- 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: diff --git a/dgamelaunch.c b/dgamelaunch.c index a253480..13a7678 100644 --- a/dgamelaunch.c +++ b/dgamelaunch.c @@ -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); diff --git a/dgamelaunch.h b/dgamelaunch.h index 7318daa..234e93f 100644 --- a/dgamelaunch.h +++ b/dgamelaunch.h @@ -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 */ diff --git a/dgl-common.c b/dgl-common.c index d7d2794..f66ae2a 100644 --- a/dgl-common.c +++ b/dgl-common.c @@ -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; -- 2.47.3