diff options
author | vincentdarley <vincentdarley@noemail.net> | 2003-02-12 18:57:43 (GMT) |
---|---|---|
committer | vincentdarley <vincentdarley@noemail.net> | 2003-02-12 18:57:43 (GMT) |
commit | e1da2e07b654c0c9bd05b15bbc0756acfa89951a (patch) | |
tree | b100d4dd9bf3072e691813a756381ae21d9309ae /unix/tclUnixFile.c | |
parent | 5f45ab05e3f87154ae1aba79c92fa5973be3efc0 (diff) | |
download | tcl-e1da2e07b654c0c9bd05b15bbc0756acfa89951a.zip tcl-e1da2e07b654c0c9bd05b15bbc0756acfa89951a.tar.gz tcl-e1da2e07b654c0c9bd05b15bbc0756acfa89951a.tar.bz2 |
glob -l on broken symlink fix
FossilOrigin-Name: be22ec9c7965c67002d4e998fc2b4e58fe9db82f
Diffstat (limited to 'unix/tclUnixFile.c')
-rw-r--r-- | unix/tclUnixFile.c | 16 |
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; } } |