Tcl Source Code

Artifact [470bf11c0e]
Login

Artifact 470bf11c0e245d8bcb866e6d2d1d70de08a5c20278477aad696c2ed00c11b4b8:

Attachment "file-delete-racecond.diff" to ticket [27b6822849] added by raimue 2018-04-06 14:05:33. (unpublished)
Index: generic/tclFCmd.c
==================================================================
--- generic/tclFCmd.c
+++ generic/tclFCmd.c
@@ -401,10 +401,18 @@
 		    errfile = objv[i];
 		}
 	    }
 	} else {
 	    result = Tcl_FSDeleteFile(objv[i]);
+            if (result != TCL_OK && errno == ENOENT) {
+                /*
+                 * The file was already deleted before we could do it.
+                 * Deleting a non-existent file is not an error.
+                 */
+
+                result = TCL_OK;
+            }
 	}
 
 	if (result != TCL_OK) {
 	    result = TCL_ERROR;