from Folkert van Heusden's code review
This commit is contained in:
parent
33a8de391e
commit
6b4f2559c6
@ -479,7 +479,7 @@ int open_psdb_message(const char *restrict override, void (*message)(const char
|
|||||||
};
|
};
|
||||||
struct stat sbuf;
|
struct stat sbuf;
|
||||||
struct utsname uts;
|
struct utsname uts;
|
||||||
char path[64];
|
char path[128];
|
||||||
const char **fmt = sysmap_paths;
|
const char **fmt = sysmap_paths;
|
||||||
const char *sm;
|
const char *sm;
|
||||||
|
|
||||||
@ -509,9 +509,10 @@ int open_psdb_message(const char *restrict override, void (*message)(const char
|
|||||||
|
|
||||||
// finally, search for the System.map file
|
// finally, search for the System.map file
|
||||||
uname(&uts);
|
uname(&uts);
|
||||||
|
path[sizeof path - 1] = '\0';
|
||||||
do{
|
do{
|
||||||
int did_ksyms = 0;
|
int did_ksyms = 0;
|
||||||
snprintf(path, sizeof path, *fmt, uts.release);
|
snprintf(path, sizeof path - 1, *fmt, uts.release);
|
||||||
if(!stat(path, &sbuf)){
|
if(!stat(path, &sbuf)){
|
||||||
if (did_ksyms++) read_and_parse();
|
if (did_ksyms++) read_and_parse();
|
||||||
if (sysmap_mmap(path, message)) return 0;
|
if (sysmap_mmap(path, message)) return 0;
|
||||||
|
7
sysctl.c
7
sysctl.c
@ -313,9 +313,9 @@ static int WriteSetting(const char *setting) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int Preload(const char *restrict const filename) {
|
static int Preload(const char *restrict const filename) {
|
||||||
|
char oneline[256];
|
||||||
|
char buffer[256];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char oneline[257];
|
|
||||||
char buffer[257];
|
|
||||||
char *t;
|
char *t;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
@ -326,8 +326,7 @@ static int Preload(const char *restrict const filename) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (fgets(oneline, 256, fp)) {
|
while (fgets(oneline, sizeof oneline, fp)) {
|
||||||
oneline[256] = 0;
|
|
||||||
n++;
|
n++;
|
||||||
t = StripLeadingAndTrailingSpaces(oneline);
|
t = StripLeadingAndTrailingSpaces(oneline);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user