diff options
author | hobbs <hobbs@noemail.net> | 2002-04-22 22:51:18 (GMT) |
---|---|---|
committer | hobbs <hobbs@noemail.net> | 2002-04-22 22:51:18 (GMT) |
commit | 7177fac16530ad5c08c06389ea912e1891ac0b22 (patch) | |
tree | 9335ecc34b31aaa5b4e4b1f7df1079a5d37dcb25 /win/tclWinFCmd.c | |
parent | 730a08583c386e4bfd1916db0c5c3bc727c8a8c3 (diff) | |
download | tcl-7177fac16530ad5c08c06389ea912e1891ac0b22.zip tcl-7177fac16530ad5c08c06389ea912e1891ac0b22.tar.gz tcl-7177fac16530ad5c08c06389ea912e1891ac0b22.tar.bz2 |
* win/tclWinFCmd.c (DoDeleteFile): check return of setattr API
calls in file deletion for correct Win32 API handling.
FossilOrigin-Name: cc5e4c173c393cdaeca3da1ab0a2ccad479311bc
Diffstat (limited to 'win/tclWinFCmd.c')
-rw-r--r-- | win/tclWinFCmd.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index ce53359..098a409 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.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: tclWinFCmd.c,v 1.28 2002/03/24 11:41:51 vincentdarley Exp $ + * RCS: @(#) $Id: tclWinFCmd.c,v 1.29 2002/04/22 22:51:19 hobbs Exp $ */ #include "tclWinInt.h" @@ -649,7 +649,7 @@ DoDeleteFile( Tcl_SetErrno(ENOENT); return TCL_ERROR; } - + if ((*tclWinProcs->deleteFileProc)(nativePath) != FALSE) { return TCL_OK; } @@ -666,13 +666,16 @@ DoDeleteFile( Tcl_SetErrno(EISDIR); } else if (attr & FILE_ATTRIBUTE_READONLY) { - (*tclWinProcs->setFileAttributesProc)(nativePath, + int res = (*tclWinProcs->setFileAttributesProc)(nativePath, attr & ~FILE_ATTRIBUTE_READONLY); - if ((*tclWinProcs->deleteFileProc)(nativePath) != FALSE) { + if ((res != 0) && ((*tclWinProcs->deleteFileProc)(nativePath) + != FALSE)) { return TCL_OK; } TclWinConvertError(GetLastError()); - (*tclWinProcs->setFileAttributesProc)(nativePath, attr); + if (res != 0) { + (*tclWinProcs->setFileAttributesProc)(nativePath, attr); + } } } } else if (Tcl_GetErrno() == ENOENT) { |