Tue Apr 14 19:05:17 EDT 1998
Vincent S. Cojot <coyote@step.polymtl.ca>

Hello, this simple and ugly patch fixes two problems:

1) In misc.c, make_dirs() tries to "mkdir" every single subset of a
give path.
I.E: for /usr/tmp/noavail, it would:
mkdir(/usr) then mkdir(/usr/tmp), then mkdir(/usr/tmp/noavail).

Unfortunately, under Linux (libc 5.4.4x), a failing mkdir would return
EACCESS instead of EEXIST when both errors are true. Solaris (2.6) appears
to put EEXIST first.

2) In change_dir.c:
in dirwasmodified():

	if (error == ENOENT) {
		.............
	} else if (error != 0) {
		.............
		dircache_delete(&local_dircache, dirname);
		dirname gets corrupted after this point and can't be used
		anymore.. 
		.............
	}

The patch follows.


*** misc.c.orig	Sun Aug 28 23:05:36 1994
--- misc.c	Tue Apr 14 15:41:41 1998
***************
*** 709,722 ****
--- 709,730 ----
  			*slash = '\0';
  			if (mkdir(dir, 0777) == -1) {
  				rval = errno;
+ #ifdef __linux__
+ 				if ( (rval != EEXIST) && (rval != EACCES))
+ #else
  				if (rval != EEXIST)
+ #endif
  					goto out;
  				rval = 0;
  			}
  			*slash = ch;
  		} else {
  			if (make_last && mkdir(dir, 0777) == -1) {
+ #ifdef __linux__
+ 				if ((errno == EEXIST) || (rval != EACCES))
+ #else
  				if (errno == EEXIST)
+ #endif
  					rval = 0;
  				else
  					rval = errno;
*** change_dir.c.orig	Sun Aug 28 23:05:43 1994
--- change_dir.c	Tue Apr 14 18:55:18 1998
***************
*** 33,38 ****
--- 33,41 ----
  {
  	int	error;
  	char	*dirname = local_dircache.first->name;
+ 	char	*tmpdirname;
+ 
+ 	tmpdirname = strdup(local_dircache.first->name);
  
  	if (cache_lookup(&local_dircache, dirname) == NULL)
  		return (0);
***************
*** 66,73 ****
  		xv_set(local_window.list,
  			XV_SHOW, TRUE,
  			NULL);
  		dircache_delete(&local_dircache, dirname);
! 		change_local_dir(dirname, 0);
  		return (1);
  	}
  	return (0);
--- 69,77 ----
  		xv_set(local_window.list,
  			XV_SHOW, TRUE,
  			NULL);
+ 
  		dircache_delete(&local_dircache, dirname);
! 		change_local_dir(tmpdirname, 0);
  		return (1);
  	}
  	return (0);
