Author: anevilyak Date: 2011-05-14 22:37:37 +0200 (Sat, 14 May 2011) New Revision: 41500 Changeset: https://dev.haiku-os.org/changeset/41500 Modified: haiku/trunk/src/system/boot/loader/menu.cpp Log: When applying settings from the boot menus, aggregate them and then add them to the kernel args in a single go. Otherwise we wind up with more link list entries than expected, which in turn resulted in settings not quite being parsed properly upon entering the kernel, which meant that if options were chosen in both the debug and safe mode menus, only the debug ones were applied. This might also have resulted in the kernel settings not being loaded correctly in such an instance. Should fix various issues people have had with safe mode settings not being applied properly. Modified: haiku/trunk/src/system/boot/loader/menu.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/menu.cpp 2011-05-14 18:59:26 UTC (rev 41499) +++ haiku/trunk/src/system/boot/loader/menu.cpp 2011-05-14 20:37:37 UTC (rev 41500) @@ -837,25 +837,20 @@ static void -apply_safe_mode_options(Menu* menu) +apply_safe_mode_options(Menu* menu, char *buffer, size_t bufferSize) { - char buffer[2048]; - int32 pos = 0; + int32 pos = strlen(buffer); - buffer[0] = '\0'; - MenuItemIterator iterator = menu->ItemIterator(); while (MenuItem* item = iterator.Next()) { if (item->Type() == MENU_ITEM_SEPARATOR || !item->IsMarked() || item->Data() == NULL || (uint32)pos > sizeof(buffer)) continue; - size_t totalBytes = snprintf(buffer + pos, sizeof(buffer) - pos, + size_t totalBytes = snprintf(buffer + pos, bufferSize - pos, "%s true\n", (const char*)item->Data()); pos += std::min(totalBytes, sizeof(buffer) - pos - 1); } - - add_safe_mode_settings(buffer); } @@ -911,10 +906,16 @@ if (item->Data() != NULL) *_bootVolume = (Directory*)item->Data(); - apply_safe_mode_options(safeModeMenu); - apply_safe_mode_options(debugMenu); + char buffer[2048]; + + memset(buffer, 0, sizeof(buffer)); + + apply_safe_mode_options(safeModeMenu, buffer, sizeof(buffer)); + apply_safe_mode_options(debugMenu, buffer, sizeof(buffer)); + add_safe_mode_settings(buffer); delete menu; + TRACE(("user_menu: leave\n")); return B_OK;