diff options
Diffstat (limited to 'sbin/dmesg/dmesg.c')
-rw-r--r-- | sbin/dmesg/dmesg.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c index 541e9df..3883688 100644 --- a/sbin/dmesg/dmesg.c +++ b/sbin/dmesg/dmesg.c @@ -45,6 +45,7 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ +#include <sys/types.h> #include <sys/msgbuf.h> #include <err.h> @@ -53,9 +54,10 @@ static const char rcsid[] = #include <locale.h> #include <stdio.h> #include <stdlib.h> +#include <sysexits.h> +#include <syslog.h> #include <unistd.h> #include <vis.h> -#include <sys/syslog.h> struct nlist nl[] = { #define X_MSGBUF 0 @@ -109,6 +111,9 @@ main(argc, argv) if (memf != NULL || nlistf != NULL) setgid(getgid()); + if (all && getuid()) + errx(EX_NOPERM, "must be root to use -a"); + /* Read in kernel message buffer, do sanity checks. */ if ((kd = kvm_open(nlistf, memf, NULL, O_RDONLY, "dmesg")) == NULL) exit (1); |