mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-21 16:32:25 +01:00
Reviewed by:
Submitted by: Put in a signal handler to catch the SIGSYS signal that indicates that ktrace was not built into the kernel and prevent ktrace to core dump somewhere.
This commit is contained in:
parent
80c02d5983
commit
b013076737
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2354
@ -49,8 +49,15 @@ static char sccsid[] = "@(#)ktrace.c 8.1 (Berkeley) 6/6/93";
|
||||
#include <sys/uio.h>
|
||||
#include <sys/ktrace.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include "ktrace.h"
|
||||
|
||||
void noktrace() {
|
||||
(void)fprintf(stderr, "ktrace: ktrace not enabled in kernel,to use ktrace\n");
|
||||
(void)fprintf(stderr, "you need to add a line \"options KTRACE\" to your kernel\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
@ -65,6 +72,9 @@ main(argc, argv)
|
||||
append = ops = pidset = inherit = 0;
|
||||
trpoints = DEF_POINTS;
|
||||
tracefile = DEF_TRACEFILE;
|
||||
/* set up a signal handler for SIGSYS, this indicates that ktrace
|
||||
is not enabled in the kernel */
|
||||
signal(SIGSYS, noktrace);
|
||||
while ((ch = getopt(argc,argv,"aCcdf:g:ip:t:")) != EOF)
|
||||
switch((char)ch) {
|
||||
case 'a':
|
||||
|
Loading…
Reference in New Issue
Block a user