It would seem filename_inizialize() is buggy:
It tries to mkdir("") which obviously fails, and they fails if some dirs
already exist (which is true for /tmp usually)...

This seems to fix it for the Haiku port (which didn't call it yet but
used a native call instead with the wrong permissions).

I don't think it breaks any other port using it (win, RO).
Comments?

François.
diff --git a/utils/filename.c b/utils/filename.c
index 5306418..fa87d29 100644
--- a/utils/filename.c
+++ b/utils/filename.c
@@ -181,10 +181,11 @@ bool filename_initialise(void)
 		return false;
 
 	for (start = directory; *start != '\0'; start++) {
-		if (*start == '/') {
+		if (*start == '/' && start != directory) {
 			*start = '\0';
 			ret = nsmkdir(directory, S_IRWXU);
-			if (ret != 0) {
+			LOG(("nsmkdir('%s'): %d %08lx", directory, ret, errno));
+			if (ret != 0 && errno != EEXIST) {
 				free(directory);
 
 				return false;

Reply via email to