Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Apr 2019 20:31:21 +0000
From:      bugzilla-noreply@freebsd.org
To:        toolchain@FreeBSD.org
Subject:   [Bug 236714] Clang problem with rctl(8)
Message-ID:  <bug-236714-29464-com01PqENS@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-236714-29464@https.bugs.freebsd.org/bugzilla/>
References:  <bug-236714-29464@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236714

--- Comment #12 from Mateusz Guzik <mjg@FreeBSD.org> ---
It is not being ignored. There is non-zero garbage in an area not written t=
o by
sysctl, which makes the zero comparison fail.

diff --git a/usr.bin/rctl/rctl.c b/usr.bin/rctl/rctl.c
index 74073c13207e..8fb9e862aee8 100644
--- a/usr.bin/rctl/rctl.c
+++ b/usr.bin/rctl/rctl.c
@@ -378,12 +378,15 @@ print_rules(char *rules, int hflag, int nflag)
 static void
 enosys(void)
 {
-       int error, racct_enable;
+       int error, racct_enable =3D ~(0);
        size_t racct_enable_len;

+
+       printf("%x\n", racct_enable);
        racct_enable_len =3D sizeof(racct_enable);
        error =3D sysctlbyname("kern.racct.enable",
            &racct_enable, &racct_enable_len, NULL, 0);
+       printf("%x\n", racct_enable);

        if (error !=3D 0) {
                if (errno =3D=3D ENOENT)

Results in:
ffffffff
ffffff00
a.out: failed to show rules for '::': Function not implemented

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236714-29464-com01PqENS>