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.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41500 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-05-14 20:37:37 +00:00
parent 502fc780bf
commit e21407d07b
+11 -10
View File
@@ -837,12 +837,9 @@ add_debug_menu()
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;
buffer[0] = '\0';
int32 pos = strlen(buffer);
MenuItemIterator iterator = menu->ItemIterator();
while (MenuItem* item = iterator.Next()) {
@@ -850,12 +847,10 @@ apply_safe_mode_options(Menu* menu)
|| 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 @@ user_menu(Directory** _bootVolume)
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;