From d165eb244ad4b9050dee074a00ecdda41df575ed Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 29 Oct 2001 14:25:03 +0000 Subject: Fix for bug 475941; access() was being called with path-free file names on some paths through the glob code! --- ChangeLog | 7 +++++++ unix/tclUnixFile.c | 9 ++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 31c672a..3a22e8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-10-29 Donal K. Fellows + + * unix/tclUnixFile.c (TclpMatchInDirectory): Argument to access() + was entryPtr->d_name instead of nativeEntry which failed when + trying to check access for files in other than the current + directory. [Bug 475941, reported by Georgios Petasis] + 2001-10-25 Donal K. Fellows * unix/tclUnixChan.c: Added stateUpdated member to struct TtyState. diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index befa699..d78dca4 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.12 2001/08/30 08:53:15 vincentdarley Exp $ + * RCS: @(#) $Id: tclUnixFile.c,v 1.13 2001/10/29 14:25:03 dkf Exp $ */ #include "tclInt.h" @@ -301,7 +301,6 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) if (entryPtr == NULL) { break; } - if (types != NULL && (types->perm & TCL_GLOB_PERM_HIDDEN)) { /* * We explicitly asked for hidden files, so turn around @@ -365,11 +364,11 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) ((types->perm & TCL_GLOB_PERM_RONLY) && (buf.st_mode & (S_IWOTH|S_IWGRP|S_IWUSR))) || ((types->perm & TCL_GLOB_PERM_R) && - (access(entryPtr->d_name, R_OK) != 0)) || + (access(nativeEntry, R_OK) != 0)) || ((types->perm & TCL_GLOB_PERM_W) && - (access(entryPtr->d_name, W_OK) != 0)) || + (access(nativeEntry, W_OK) != 0)) || ((types->perm & TCL_GLOB_PERM_X) && - (access(entryPtr->d_name, X_OK) != 0)) + (access(nativeEntry, X_OK) != 0)) )) { typeOk = 0; } -- cgit v0.12