sys_netbsd: don't check access to /dev/clockctl with -x

With the -x option there is no need for write access to /dev/clockctl.
This commit is contained in:
Miroslav Lichvar
2020-10-05 18:25:50 +02:00
parent 8e9716d5d4
commit e4cccc115d
3 changed files with 6 additions and 3 deletions

View File

@@ -131,7 +131,7 @@ SYS_NetBSD_Finalise(void)
#ifdef FEAT_PRIVDROP
void
SYS_NetBSD_DropRoot(uid_t uid, gid_t gid, SYS_ProcessContext context)
SYS_NetBSD_DropRoot(uid_t uid, gid_t gid, SYS_ProcessContext context, int clock_control)
{
#ifdef NETBSD
int fd;
@@ -145,6 +145,9 @@ SYS_NetBSD_DropRoot(uid_t uid, gid_t gid, SYS_ProcessContext context)
UTI_DropRoot(uid, gid);
#ifdef NETBSD
if (!clock_control)
return;
/* Check if we have write access to /dev/clockctl */
fd = open("/dev/clockctl", O_WRONLY);
if (fd < 0)