diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-05-23 20:09:24 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2018-05-23 20:09:24 (GMT) |
commit | ca0f6f2273f4dd8d7b7449a4da43e34d5a98d4f2 (patch) | |
tree | 3e0b07f6812a5848ee549cc167985bb03acf98da /generic/tclFCmd.c | |
parent | b013797f961380e6a2ddd366c96c570d736bd746 (diff) | |
parent | a9e7c22c38a58f2248f2bd51529411914cd16e06 (diff) | |
download | tcl-ca0f6f2273f4dd8d7b7449a4da43e34d5a98d4f2.zip tcl-ca0f6f2273f4dd8d7b7449a4da43e34d5a98d4f2.tar.gz tcl-ca0f6f2273f4dd8d7b7449a4da43e34d5a98d4f2.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tclFCmd.c')
-rw-r--r-- | generic/tclFCmd.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index 80898fc..ddfe3bf 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -363,14 +363,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 @@ -406,13 +399,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; } } |