* Update the size of the safemode settings "file" when concatenating it with

the kernel settings. Settings that were checked in the kernel (like on-screen
  debug output) didn't work anymore, because when handing the settings over to
  the kernel it would have copied only the old size part of the safemode file.
* Add a newline when the kernel and safemode settings are combined. Otherwise
  the first safemode and last kernel setting would get lost if the kernel
  settings file didn't end with a newline.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26992 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2008-08-16 18:06:52 +00:00
parent dd76369ea7
commit ee8d227588

View File

@ -107,17 +107,24 @@ load_driver_settings(stage2_args */*args*/, Directory *volume)
find_driver_settings_file(B_SAFEMODE_DRIVER_SETTINGS);
if (safemodeFile != NULL) {
char *buffer = (char *)kernel_args_malloc(
safemodeFile->size + kernelFile->size + 1);
safemodeFile->size + kernelFile->size + 2);
if (buffer != NULL) {
memcpy(buffer, kernelFile->buffer,
kernelFile->size);
memcpy(buffer + kernelFile->size,
// insert a newline just in case the kernel settings file
// doesn't end with one
buffer[kernelFile->size] = '\n';
memcpy(buffer + kernelFile->size + 1,
safemodeFile->buffer,
safemodeFile->size);
buffer[safemodeFile->size +
kernelFile->size] = '\0';
kernel_args_free(safemodeFile->buffer);
safemodeFile->buffer = buffer;
safemodeFile->size = safemodeFile->size +
kernelFile->size + 1;
buffer[safemodeFile->size] = '\0';
}
} else
add_safe_mode_settings(kernelFile->buffer);