From 64321856827557769e2a68ac721330f82a3c7065 Mon Sep 17 00:00:00 2001 From: dkf Date: Wed, 19 May 2004 22:50:22 +0000 Subject: Backport of bizarre error-loss bug found by KBK and myself. --- ChangeLog | 10 ++++++++++ win/tclWinFile.c | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74ae073..65cd4f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-05-19 Donal K. Fellows + + * win/tclWinFile.c (TclpMatchInDirectory): fix for an issue + where there was a sneak path from Tcl_DStringFree to + SetErrorCode(0). The result was that the error code could + be reset between a call to FindFirstFile and the check + of its status return, leading to a bizarre error return of + {POSIX unknown {No error}}. (Found in unplanned test - + no incident logged at SourceForge.) + 2004-05-19 Andreas Kupries * tclIO.c: Fixed [SF Tcl Bug 943274]. This is the same problem as diff --git a/win/tclWinFile.c b/win/tclWinFile.c index 6e1dde1..b29e9d1 100644 --- a/win/tclWinFile.c +++ b/win/tclWinFile.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinFile.c,v 1.44.2.7 2004/03/29 18:49:36 hobbs Exp $ + * RCS: @(#) $Id: tclWinFile.c,v 1.44.2.8 2004/05/19 22:50:23 dkf Exp $ */ //#define _WIN32_WINNT 0x0500 @@ -844,11 +844,11 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) dirName = Tcl_DStringAppend(&dirString, "*.*", 3); native = Tcl_WinUtfToTChar(dirName, -1, &ds); handle = (*tclWinProcs->findFirstFileProc)(native, &data); - Tcl_DStringFree(&ds); if (handle == INVALID_HANDLE_VALUE) { - Tcl_DStringFree(&dirString); TclWinConvertError(GetLastError()); + Tcl_DStringFree(&ds); + Tcl_DStringFree(&dirString); Tcl_ResetResult(interp); Tcl_AppendResult(interp, "couldn't read directory \"", Tcl_DStringValue(&dsOrig), "\": ", @@ -856,6 +856,7 @@ TclpMatchInDirectory(interp, resultPtr, pathPtr, pattern, types) Tcl_DStringFree(&dsOrig); return TCL_ERROR; } + Tcl_DStringFree(&ds); /* * Check to see if the pattern should match the special -- cgit v0.12