Index: tclUnixFile.c
===================================================================
RCS file: /cvsroot/tcl/tcl/unix/tclUnixFile.c,v
retrieving revision 1.10
diff -U3 -r1.10 tclUnixFile.c
--- tclUnixFile.c	2001/07/31 19:12:07	1.10
+++ tclUnixFile.c	2001/08/08 17:32:04
@@ -333,13 +333,24 @@
 		    struct stat buf;
 
 		    if (TclpStat(fname, &buf) != 0) {
-			panic("stat failed on known file");
+			if (TclpLstat(fname, &buf) != 0) {
+			    panic("stat failed on known file");
+			} else {
+			    /* 
+			     * The file is a link to a file which
+			     * doesn't exist.  We define this to
+			     * mean it does not match any defined
+			     * permission.
+			     */
+			    typeOk = 0;
+			}
 		    }
+		    
 		    /* 
 		     * readonly means that there are NO write permissions
 		     * (even for user), but execute is OK for anybody
 		     */
-		    if (
+		    if (typeOk && (
 			((types->perm & TCL_GLOB_PERM_RONLY) &&
 				(buf.st_mode & (S_IWOTH|S_IWGRP|S_IWUSR))) ||
 			((types->perm & TCL_GLOB_PERM_R) &&
@@ -348,7 +359,7 @@
 				(TclpAccess(fname, W_OK) != 0)) ||
 			((types->perm & TCL_GLOB_PERM_X) &&
 				(TclpAccess(fname, X_OK) != 0))
-			) {
+			)) {
 			typeOk = 0;
 		    }
 		}
