Don't chdir with NOCWD_ASSUMPTIONS
This commit is contained in:
+2
-2
@@ -221,7 +221,7 @@ char *argv[];
|
|||||||
*/
|
*/
|
||||||
if (!strncmp(argv[1], "-s", 2)) {
|
if (!strncmp(argv[1], "-s", 2)) {
|
||||||
#if !defined(MSWIN_GRAPHICS)
|
#if !defined(MSWIN_GRAPHICS)
|
||||||
# ifdef CHDIR
|
# if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(hackdir,0);
|
chdirx(hackdir,0);
|
||||||
# endif
|
# endif
|
||||||
prscore(argc, argv);
|
prscore(argc, argv);
|
||||||
@@ -252,7 +252,7 @@ char *argv[];
|
|||||||
/* chdir shouldn't be called before this point to keep the
|
/* chdir shouldn't be called before this point to keep the
|
||||||
* code parallel to other ports.
|
* code parallel to other ports.
|
||||||
*/
|
*/
|
||||||
#ifdef CHDIR
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(hackdir,1);
|
chdirx(hackdir,1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -95,7 +95,9 @@ dosh()
|
|||||||
# endif
|
# endif
|
||||||
suspend_nhwindows((char *)0);
|
suspend_nhwindows((char *)0);
|
||||||
# endif /* TOS */
|
# endif /* TOS */
|
||||||
|
# ifndef NOCWD_ASSUMPTIONS
|
||||||
chdirx(orgdir, 0);
|
chdirx(orgdir, 0);
|
||||||
|
# endif
|
||||||
# ifdef __GO32__
|
# ifdef __GO32__
|
||||||
if (system(comspec) < 0) { /* wsu@eecs.umich.edu */
|
if (system(comspec) < 0) { /* wsu@eecs.umich.edu */
|
||||||
# else
|
# else
|
||||||
@@ -120,7 +122,9 @@ dosh()
|
|||||||
if (iflags.BIOS)
|
if (iflags.BIOS)
|
||||||
(void)Cursconf(1, -1);
|
(void)Cursconf(1, -1);
|
||||||
# endif
|
# endif
|
||||||
|
# ifndef NOCWD_ASSUMPTIONS
|
||||||
chdirx(hackdir, 0);
|
chdirx(hackdir, 0);
|
||||||
|
# endif
|
||||||
get_scr_size(); /* maybe the screen mode changed (TH) */
|
get_scr_size(); /* maybe the screen mode changed (TH) */
|
||||||
# if defined(MSDOS) && defined(NO_TERMS)
|
# if defined(MSDOS) && defined(NO_TERMS)
|
||||||
if (grmode) gr_init();
|
if (grmode) gr_init();
|
||||||
@@ -512,7 +516,7 @@ static void msexit()
|
|||||||
#ifdef MFLOPPY
|
#ifdef MFLOPPY
|
||||||
if (ramdisk) copybones(TOPERM);
|
if (ramdisk) copybones(TOPERM);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CHDIR
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdir(orgdir); /* chdir, not chdirx */
|
chdir(orgdir); /* chdir, not chdirx */
|
||||||
chdrive(orgdir);
|
chdrive(orgdir);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -106,7 +106,9 @@ getlock()
|
|||||||
/* we ignore QUIT and INT at this point */
|
/* we ignore QUIT and INT at this point */
|
||||||
if (!lock_file(HLOCK, LOCKPREFIX, 10)) {
|
if (!lock_file(HLOCK, LOCKPREFIX, 10)) {
|
||||||
wait_synch();
|
wait_synch();
|
||||||
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(orgdir, 0);
|
chdirx(orgdir, 0);
|
||||||
|
#endif
|
||||||
error("Quitting.");
|
error("Quitting.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,7 +118,9 @@ getlock()
|
|||||||
fq_lock = fqname(lock, LEVELPREFIX, 1);
|
fq_lock = fqname(lock, LEVELPREFIX, 1);
|
||||||
if((fd = open(fq_lock,0)) == -1) {
|
if((fd = open(fq_lock,0)) == -1) {
|
||||||
if(errno == ENOENT) goto gotlock; /* no such file */
|
if(errno == ENOENT) goto gotlock; /* no such file */
|
||||||
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(orgdir, 0);
|
chdirx(orgdir, 0);
|
||||||
|
#endif
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
error("Bad directory or name: %s\n%s\n",
|
error("Bad directory or name: %s\n%s\n",
|
||||||
fq_lock, strerror(errno));
|
fq_lock, strerror(errno));
|
||||||
@@ -169,12 +173,16 @@ getlock()
|
|||||||
goto gotlock;
|
goto gotlock;
|
||||||
} else {
|
} else {
|
||||||
unlock_file(HLOCK);
|
unlock_file(HLOCK);
|
||||||
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(orgdir, 0);
|
chdirx(orgdir, 0);
|
||||||
|
#endif
|
||||||
error("Couldn't destroy old game.");
|
error("Couldn't destroy old game.");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unlock_file(HLOCK);
|
unlock_file(HLOCK);
|
||||||
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(orgdir, 0);
|
chdirx(orgdir, 0);
|
||||||
|
#endif
|
||||||
error("%s", "");
|
error("%s", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +191,9 @@ gotlock:
|
|||||||
if (fd == -1) ern = errno;
|
if (fd == -1) ern = errno;
|
||||||
unlock_file(HLOCK);
|
unlock_file(HLOCK);
|
||||||
if(fd == -1) {
|
if(fd == -1) {
|
||||||
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(orgdir, 0);
|
chdirx(orgdir, 0);
|
||||||
|
#endif
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
error("cannot creat file (%s.)\n%s\n%s\"%s\" exists?\n",
|
error("cannot creat file (%s.)\n%s\n%s\"%s\" exists?\n",
|
||||||
fq_lock, strerror(ern), " Are you sure that the directory",
|
fq_lock, strerror(ern), " Are you sure that the directory",
|
||||||
@@ -194,11 +204,15 @@ gotlock:
|
|||||||
} else {
|
} else {
|
||||||
if(write(fd, (char *) &hackpid, sizeof(hackpid))
|
if(write(fd, (char *) &hackpid, sizeof(hackpid))
|
||||||
!= sizeof(hackpid)){
|
!= sizeof(hackpid)){
|
||||||
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(orgdir, 0);
|
chdirx(orgdir, 0);
|
||||||
|
#endif
|
||||||
error("cannot write lock (%s)", fq_lock);
|
error("cannot write lock (%s)", fq_lock);
|
||||||
}
|
}
|
||||||
if(close(fd) == -1) {
|
if(close(fd) == -1) {
|
||||||
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdirx(orgdir, 0);
|
chdirx(orgdir, 0);
|
||||||
|
#endif
|
||||||
error("cannot close lock (%s)", fq_lock);
|
error("cannot close lock (%s)", fq_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user