Artifact
d7f80b264a2d5f5afefbf5021db01f502234b2bc:
Attachment "tclFCmd.c-mkdir.patch" to
ticket [1217375fff]
added by
diekhans
2005-06-09 11:35:53.
--- generic/.emacs.bak/tclFCmd.c.~1~ 2005-05-10 12:14:25.000000000 -0700
+++ generic/tclFCmd.c 2005-06-08 18:14:49.919095768 -0700
@@ -261,11 +261,31 @@
errfile = target;
goto done;
}
- } else if ((errno != ENOENT)
- || (Tcl_FSCreateDirectory(target) != TCL_OK)) {
+ } else if (errno != ENOENT) {
errfile = target;
goto done;
}
+
+ if (Tcl_FSCreateDirectory(target) != TCL_OK) {
+ /*
+ * create might have failed because of being in a race
+ * condition with another process trying to create the same
+ * subdirectory.
+ */
+ if (errno == EEXIST) {
+ if ((Tcl_FSStat(target, &statBuf) == 0)
+ && S_ISDIR(statBuf.st_mode)) {
+ /* is a directory that wasn't there before, keep going */
+ Tcl_ResetResult(interp);
+ } else {
+ errfile = target;
+ goto done;
+ }
+ } else {
+ errfile = target;
+ goto done;
+ }
+ }
/* Forget about this sub-path */
Tcl_DecrRefCount(target);
target = NULL;