Increased the size of the kernel command line buffer in bootlogd

from 256 characters to 4096. This size is defined in KERNEL_COMMAND_LENGTH
for easy modification downstream.
This commit is contained in:
Jesse Smith 2018-12-29 14:46:10 -04:00
parent 9e8553cacb
commit 5d955d55c8
2 changed files with 7 additions and 5 deletions

View File

@ -15,6 +15,10 @@ sysvinit (2.94) unreleased; urgency=low
and freeing is now handled in stdlib.h and freeing is now handled in stdlib.h
* Added defines for FreeBSD to make some components compile * Added defines for FreeBSD to make some components compile
on FreeBSD 11. on FreeBSD 11.
* Increased the size of the kernel command line buffer in bootlogd
from 256 characters to 4096. This size is defined in KERNEL_COMMAND_LENGTH
for easy modification downstream.
sysvinit (2.93) released; urgency=low sysvinit (2.93) released; urgency=low

View File

@ -63,6 +63,7 @@
#include "bootlogd.h" #include "bootlogd.h"
#define MAX_CONSOLES 16 #define MAX_CONSOLES 16
#define KERNEL_COMMAND_LENGTH 4096
char ringbuf[32768]; char ringbuf[32768];
char *endptr = ringbuf + sizeof(ringbuf); char *endptr = ringbuf + sizeof(ringbuf);
@ -257,7 +258,7 @@ int consolenames(struct real_cons *cons, int max_consoles)
/* This appears to be unused. unsigned int kdev; */ /* This appears to be unused. unsigned int kdev; */
#endif #endif
struct stat st, st2; struct stat st, st2;
char buf[256]; char buf[KERNEL_COMMAND_LENGTH];
char *p; char *p;
int didmount = 0; int didmount = 0;
int n; int n;
@ -286,17 +287,14 @@ int consolenames(struct real_cons *cons, int max_consoles)
perror("bootlogd: /proc/cmdline"); perror("bootlogd: /proc/cmdline");
} else { } else {
buf[0] = 0; buf[0] = 0;
if ((n = read(fd, buf, sizeof(buf) - 1)) < 0) if ((n = read(fd, buf, KERNEL_COMMAND_LENGTH - 1)) < 0)
perror("bootlogd: /proc/cmdline"); perror("bootlogd: /proc/cmdline");
close(fd); close(fd);
} }
if (didmount) umount("/proc"); if (didmount) umount("/proc");
if (n < 0) return 0; if (n < 0) return 0;
/* /*
* OK, so find console= in /proc/cmdline. * OK, so find console= in /proc/cmdline.
* Parse in reverse, opening as we go. * Parse in reverse, opening as we go.