Commit 048ce087 authored by Eugene Grosbein's avatar Eugene Grosbein
Browse files

adjkerntz(8): detect extra jailed invokation to keep logs clean

It may happen that "adjkerntz -a" called from jailed root crontab.
In that case it spams logs with a line:

sysctl(set: "machdep.wall_cmos_clock"): Operation not permitted

Be silent in that case.

MFC after:	1 month
parent b4bdc8f9
......@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
* with Garrett Wollman and Bruce Evans fixes.
*
*/
#include <errno.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
......@@ -159,6 +160,12 @@ main(int argc, char *argv[])
len = sizeof(kern_offset);
if (sysctlbyname("machdep.adjkerntz", &kern_offset, &len, NULL, 0) == -1) {
if (errno == EPERM && !init && geteuid() == 0)
/*
* Surplus call from jailed root crontab.
* Avoid spamming logs.
*/
return 1;
syslog(LOG_ERR, "sysctl(\"machdep.adjkerntz\"): %m");
return 1;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment