--- libxslt-1.1.29/libxslt/security.c.orig	2013-04-01 02:31:05 +0400
+++ libxslt-1.1.29/libxslt/security.c	2013-04-01 02:32:21 +0400
@@ -342,8 +342,16 @@
 		}
 	    }
 	    ret = xsltCheckWritePath(sec, ctxt, directory);
-	    if (ret == 1)
+	    if (ret == 1) {
 		ret = mkdir(directory, 0755);
+		if (ret == -1 && errno == EEXIST) {
+		    struct stat buf;
+                    ret = stat(directory, &buf);
+                    if (ret == 0) {
+                        ret = S_ISDIR(buf.st_mode) ? 0 : -1;
+                    }
+		}
+	    }
 	}
 	xmlFree(directory);
 	if (ret < 0)
