diff options
author | hobbs <hobbs> | 2002-04-22 22:51:19 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-04-22 22:51:19 (GMT) |
commit | a7f38ba565d2e7732027570cbe7c83fd88d50ca6 (patch) | |
tree | 9335ecc34b31aaa5b4e4b1f7df1079a5d37dcb25 /win/tclWinFCmd.c | |
parent | f26bbe250fda8cf6b04b7faa5db840b95fff4e14 (diff) | |
download | tcl-a7f38ba565d2e7732027570cbe7c83fd88d50ca6.zip tcl-a7f38ba565d2e7732027570cbe7c83fd88d50ca6.tar.gz tcl-a7f38ba565d2e7732027570cbe7c83fd88d50ca6.tar.bz2 |
* win/tclWinFCmd.c (DoDeleteFile): check return of setattr API
calls in file deletion for correct Win32 API handling.
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) { |