Skip to content

Commit dc8bdfe

Browse files
Attempt to fix bootstrap installation failure that may be caused by invalid mkdirs return value
1 parent c6b4114 commit dc8bdfe

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

termux-shared/src/main/java/com/termux/shared/file/FileUtils.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,10 @@ public static Error validateDirectoryFileExistenceAndPermissions(String label, f
326326
if (createDirectoryIfMissing && fileType == FileType.NO_EXIST) {
327327
Logger.logVerbose(LOG_TAG, "Creating " + label + "directory file at path \"" + filePath + "\"");
328328
// Create directory and update fileType if successful, otherwise return with error
329-
if (file.mkdirs())
330-
fileType = getFileType(filePath, false);
331-
else
329+
// It "might" be possible that mkdirs returns false even though directory was created
330+
boolean result = file.mkdirs();
331+
fileType = getFileType(filePath, false);
332+
if (!result && fileType != FileType.DIRECTORY)
332333
return FileUtilsErrno.ERRNO_CREATING_FILE_FAILED.getError(label + "directory file", filePath);
333334
}
334335

0 commit comments

Comments
 (0)