lockfile is global, not per-game variable
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@352 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
parent
89825b1ca4
commit
d5636ad844
4
config.y
4
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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue