git: 1fec1fa8146d - main - sockstat: don't query jail vnet if system is running without VIMAGE.

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Tue, 19 Oct 2021 16:51:54 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=1fec1fa8146dc3b3244955afe337c4e9892ccb4b

commit 1fec1fa8146dc3b3244955afe337c4e9892ccb4b
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2021-10-19 16:47:54 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2021-10-19 16:49:35 +0000

    sockstat: don't query jail vnet if system is running without VIMAGE.
    
    Fixes:  f1cd4902bf17
---
 usr.bin/sockstat/sockstat.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index d30f1cad0498..d7fdb87b7490 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -1292,6 +1292,10 @@ jail_getvnet(int jid)
 {
 	struct iovec jiov[6];
 	int vnet;
+	size_t len = sizeof(vnet);
+
+	if (sysctlbyname("kern.features.vimage", &vnet, &len, NULL, 0) != 0)
+		return (0);
 
 	vnet = -1;
 	jiov[0].iov_base = __DECONST(char *, "jid");