summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2018-04-30 11:10:14 (GMT)
committersebres <sebres@users.sourceforge.net>2018-04-30 11:10:14 (GMT)
commitddfce0ed3f91a335d169f6f25cae2da7051d0631 (patch)
treeaa841cbe8a6780d3d9f2c28e9c5059c0b44516ce /generic
parentdf94eecf119611a2fa8de1abb3abe59269be7550 (diff)
parent9856afd5903e2aec8bed684abb91fe307cd20765 (diff)
downloadtcl-ddfce0ed3f91a335d169f6f25cae2da7051d0631.zip
tcl-ddfce0ed3f91a335d169f6f25cae2da7051d0631.tar.gz
tcl-ddfce0ed3f91a335d169f6f25cae2da7051d0631.tar.bz2
merge fix-1613456fff, closes [1613456fffffffff] and [27b682284974d0cd]
Diffstat (limited to 'generic')
-rw-r--r--generic/tclFCmd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index c52cd1e..1363829 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -373,14 +373,7 @@ TclFileDeleteCmd(
*/
if (Tcl_FSLstat(objv[i], &statBuf) != 0) {
- /*
- * Trying to delete a file that does not exist is not considered
- * an error, just a no-op
- */
-
- if (errno != ENOENT) {
- result = TCL_ERROR;
- }
+ result = TCL_ERROR;
} else if (S_ISDIR(statBuf.st_mode)) {
/*
* We own a reference count on errorBuffer, if it was set as a
@@ -416,13 +409,20 @@ TclFileDeleteCmd(
}
if (result != TCL_OK) {
- result = TCL_ERROR;
/*
+ * Avoid possible race condition (file/directory deleted after call
+ * of lstat), so bypass ENOENT because not an error, just a no-op
+ */
+ if (errno == ENOENT) {
+ result = TCL_OK;
+ continue;
+ }
+ /*
* It is important that we break on error, otherwise we might end
* up owning reference counts on numerous errorBuffers.
*/
-
+ result = TCL_ERROR;
break;
}
}