Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!nntp.coast.net!news.dacom.co.kr!news.kreonet.re.kr!usenet.kornet.nm.kr!agate!tfs.com!mailhub.tfs.com!julian
From: julian@mailhub.tfs.com (Julian Elischer)
Newsgroups: comp.emulators.ms-windows.wine,comp.unix.bsd.freebsd.misc
Subject: FreeBSD/WINE BUG [PATCH here]]
Date: 1 Dec 1995 11:43:52 GMT
Organization: TRW Financial Systems, Oakland, CA
Lines: 178
Message-ID: <49mppo$jfs@times.tfs.com>
References: <JULLIARD.95Nov24173146@lrcsuns.epfl.ch> <49ln40$gi4@eplet.mira.net.au> <49lrp3$gpt@times.tfs.com> <49mhr9$iqf@times.tfs.com>
NNTP-Posting-Host: mailhub.tfs.com
Summary: Patch for wine bug with FBSD
Xref: euryale.cc.adfa.oz.au comp.emulators.ms-windows.wine:2718 comp.unix.bsd.freebsd.misc:9545
Well I've looked at the code and made a patch that solves the "hanging on
directory search" BUG..
there seem to be others less obvious, but this makes quite a difference..
diff -c ./dos_fs.c /tmp/dos_fs.c
*** ./dos_fs.c Fri Nov 24 04:59:40 1995
--- /tmp/dos_fs.c Fri Dec 1 10:50:53 1995
***************
*** 858,870 ****
strncpy(dirname, unixdirname, len);
dirname[len] = 0;
unixdirname = strrchr(unixdirname, '/') + 1;
if ((ds = opendir(dirname)) == NULL)
return NULL;
dp = DosDirs;
while (dp)
{
! if (dp->inuse)
break;
if (strcmp(dp->unixpath, dirname) == 0)
break;
--- 858,873 ----
strncpy(dirname, unixdirname, len);
dirname[len] = 0;
unixdirname = strrchr(unixdirname, '/') + 1;
+ #ifdef JREOLD
if ((ds = opendir(dirname)) == NULL)
return NULL;
+ #endif /* JREOLD */
dp = DosDirs;
+ /* try reuse it if we have already done this directory.. odd */
while (dp)
{
! if (!dp->inuse) /* I think this test was reversed before */
break;
if (strcmp(dp->unixpath, dirname) == 0)
break;
***************
*** 873,881 ****
--- 876,895 ----
if (!dp)
{
dp = xmalloc(sizeof(struct dosdirent));
+ dp->ds = NULL;
dp->next = DosDirs;
DosDirs = dp;
}
+ #ifndef JREOLD
+ if (! dp->ds)
+ {
+ if ((dp->ds = ds = opendir(dirname)) == NULL)
+ {
+ dp->inuse = 0;
+ return NULL;
+ }
+ }
+ #endif /* JREOLD */
strncpy(dp->filemask, unixdirname, 12);
dp->filemask[12] = 0;
***************
*** 887,901 ****
if ((dp->telldirnum=telldir(ds)) == -1)
{
! dp->inuse = 0;
closedir(ds);
return NULL;
}
if (closedir(ds) == -1)
{
dp->inuse = 0;
return NULL;
}
return dp;
}
--- 901,921 ----
if ((dp->telldirnum=telldir(ds)) == -1)
{
! #ifdef JREOLD
! dp->inuse = 0; /* Wierd, but should rarely happen */
closedir(ds);
+ #else /* JREOLD */
+ DOS_closedir(dp);
+ #endif /* JREOLD */
return NULL;
}
+ #ifdef JREOLD
if (closedir(ds) == -1)
{
dp->inuse = 0;
return NULL;
}
+ #endif /* JREOLD */
return dp;
}
***************
*** 909,915 ****
if (!de->inuse)
return NULL;
! if (!(ds=opendir(de->unixpath))) return NULL;
seekdir(ds,de->telldirnum); /* returns no error value. strange */
if (de->search_attribute & FA_LABEL) {
--- 929,946 ----
if (!de->inuse)
return NULL;
! #ifdef JREOLD
! if (!( ds=opendir(de->unixpath))) return NULL;
! #else
! if ( ! de->ds )
! {
! if (!(de->ds = ds =opendir(de->unixpath))) return NULL;
! }
! else
! {
! ds = de->ds;
! }
! #endif /* JREOLD */
seekdir(ds,de->telldirnum); /* returns no error value. strange */
if (de->search_attribute & FA_LABEL) {
***************
*** 929,935 ****
--- 960,968 ----
do {
if ((d = readdir(ds)) == NULL) {
de->telldirnum=telldir(ds);
+ #ifdef JREOLD
closedir(ds);
+ #endif /* JREOLD */
return NULL;
}
***************
*** 955,966 ****
--- 988,1009 ----
de->filetime = st.st_mtime;
de->telldirnum = telldir(ds);
+ #ifdef JREOLD
closedir(ds);
+ #endif /* JREOLD */
return de;
}
void DOS_closedir(struct dosdirent *de)
{
+
+ #ifndef JREOLD
+ if ( de->ds )
+ {
+ closedir (de->ds);
+ de->ds = NULL;
+ }
+ #endif /* JREOLD */
if (de && de->inuse)
de->inuse = 0;
}
+----------------------------------+ ______ _ __
| __--_|\ Julian Elischer | \ U \/ / On assignment
| / \ julian@tfs.com +------>x USA \ in a very strange
| ( OZ ) 300 lakeside Dr. oakland CA. \___ ___ | country !
+- X_.---._/ USA+(510) 645-3137(wk) \_/ \\ ><DARWIN>
v LL LL