diff --git a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm --- a/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm +++ b/lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.mm @@ -425,10 +425,12 @@ open(file_spec.GetPath().c_str(), oflag, S_IRUSR | S_IWUSR); if (created_fd >= 0) { auto file_options = File::OpenOptions(0); - if ((oflag & O_RDWR) || (oflag & O_RDONLY)) - file_options |= File::eOpenOptionRead; - if ((oflag & O_RDWR) || (oflag & O_RDONLY)) - file_options |= File::eOpenOptionWrite; + if (oflag & O_RDWR) + file_options |= File::eOpenOptionReadWrite; + else if (oflag & O_WRONLY) + file_options |= File::eOpenOptionWriteOnly; + else if (oflag & O_RDONLY) + file_options |= File::eOpenOptionReadOnly; file = std::make_shared(created_fd, file_options, true); [options setValue:[NSNumber numberWithInteger:created_fd] forKey:key]; return error; // Success