Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Dec 95 03:51 PST
From:      julian@TFS.COM (Julian Elischer)
To:        ports@freebsd.org, wine-new@amscons.com
Cc:        julian@TFS.COM
Subject:   Patch for WINE to fix problem with freeBSD
Message-ID:  <m0tLTzr-0003wVC@TFS.COM>

next in thread | raw e-mail | index | archive | help

Here is a patch to fix a problem under FreeBSD, where
any access of a directory would hang the program.
this is my first venture into wine so be gentle :)
It has a lot of promise though you have to know a lot more about windows
than a Unix weeny like myself tends to know.. (e.g how DLLs work).

julian

+----------------------------------+       ______ _  __
|   __--_|\  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

----------cut here-----------------
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;
  }


###-----------------end of patch




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0tLTzr-0003wVC>