summaryrefslogtreecommitdiffstats
path: root/unix/tclUnixFile.c
diff options
context:
space:
mode:
authorvincentdarley <vincentdarley>2003-02-12 18:57:43 (GMT)
committervincentdarley <vincentdarley>2003-02-12 18:57:43 (GMT)
commita7beeb8e861f0a22b48f42d0725bd6d1c9dc6f73 (patch)
treeb100d4dd9bf3072e691813a756381ae21d9309ae /unix/tclUnixFile.c
parentb05122813d01093b2b7448f1554203b7915f0905 (diff)
downloadtcl-a7beeb8e861f0a22b48f42d0725bd6d1c9dc6f73.zip
tcl-a7beeb8e861f0a22b48f42d0725bd6d1c9dc6f73.tar.gz
tcl-a7beeb8e861f0a22b48f42d0725bd6d1c9dc6f73.tar.bz2
glob -l on broken symlink fix
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r--unix/tclUnixFile.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c
index 4e89ee1..3e74d16 100644
--- a/unix/tclUnixFile.c
+++ b/unix/tclUnixFile.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclUnixFile.c,v 1.31 2003/02/11 09:42:02 hobbs Exp $
+ * RCS: @(#) $Id: tclUnixFile.c,v 1.32 2003/02/12 18:57:52 vincentdarley Exp $
*/
#include "tclInt.h"
@@ -386,7 +386,19 @@ NativeMatchType(
if (types->perm == 0) {
/* We haven't yet done a stat on the file */
if (TclOSstat(nativeEntry, &buf) != 0) {
- /* Posix error occurred */
+ /*
+ * Posix error occurred. The only ok
+ * case is if this is a link to a nonexistent
+ * file, and the user did 'glob -l'. So
+ * we check that here:
+ */
+ if (types->type & TCL_GLOB_TYPE_LINK) {
+ if (TclOSlstat(nativeEntry, &buf) == 0) {
+ if (S_ISLNK(buf.st_mode)) {
+ return 1;
+ }
+ }
+ }
return 0;
}
}