From 0326eb80dd2ed47b7536a57fcb035ad85ae14113 Mon Sep 17 00:00:00 2001 From: "mkaply%us.ibm.com" Date: Tue, 12 Feb 2002 22:14:32 +0000 Subject: [PATCH] 117258 from nsLocalFileWin put into OS/2 to fix trap git-svn-id: svn://10.0.0.236/trunk@114314 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/xpcom/io/nsLocalFileOS2.cpp | 40 ++++++++++++++++------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/mozilla/xpcom/io/nsLocalFileOS2.cpp b/mozilla/xpcom/io/nsLocalFileOS2.cpp index 0e47402112d..4c4b4a386ad 100644 --- a/mozilla/xpcom/io/nsLocalFileOS2.cpp +++ b/mozilla/xpcom/io/nsLocalFileOS2.cpp @@ -736,30 +736,34 @@ nsLocalFile::Create(PRUint32 type, PRUint32 attributes) // create nested directories to target unsigned char* slash = _mbschr((const unsigned char*) mResolvedPath.get(), '\\'); - // skip the first '\\' - ++slash; - slash = _mbschr(slash, '\\'); - while (slash) + + if (slash) { - *slash = '\0'; - -#ifdef XP_OS2 - rv = CreateDirectoryA(NS_CONST_CAST(char*, mResolvedPath.get()), NULL); - if (rv) { - rv = ConvertOS2Error(rv); -#else - if (!CreateDirectoryA(NS_CONST_CAST(char*, mResolvedPath.get()), NULL)) { - rv = ConvertWinError(GetLastError()); -#endif - if (rv != NS_ERROR_FILE_ALREADY_EXISTS) return rv; - } - *slash = '\\'; + // skip the first '\\' ++slash; slash = _mbschr(slash, '\\'); + + while (slash) + { + *slash = '\0'; + +#ifdef XP_OS2 + rv = CreateDirectoryA(NS_CONST_CAST(char*, mResolvedPath.get()), NULL); + if (rv) { + rv = ConvertOS2Error(rv); +#else + if (!CreateDirectoryA(NS_CONST_CAST(char*, mResolvedPath.get()), NULL)) { + rv = ConvertWinError(GetLastError()); +#endif + if (rv != NS_ERROR_FILE_ALREADY_EXISTS) return rv; + } + *slash = '\\'; + ++slash; + slash = _mbschr(slash, '\\'); + } } - if (type == NORMAL_FILE_TYPE) { PRFileDesc* file = PR_Open(mResolvedPath.get(), PR_RDONLY | PR_CREATE_FILE | PR_APPEND | PR_EXCL, attributes);