Date: 09 Jul 2001 03:11:35 +0200 From: Dag-Erling Smorgrav <des@ofug.org> To: Jens Schweikhardt <schweikh@schweikhardt.net> Cc: freebsd-current@FreeBSD.ORG Subject: Re: sysctl -A prints garbage Message-ID: <xzpvgl2oqig.fsf@flood.ping.uio.no> In-Reply-To: <xzpzoaeoqo8.fsf@flood.ping.uio.no> References: <20010708210717.A21541@schweikhardt.net> <xzpzoaeoqo8.fsf@flood.ping.uio.no>
next in thread | previous in thread | raw e-mail | index | archive | help
Dag-Erling Smorgrav <des@ofug.org> writes:
> Jens Schweikhardt <schweikh@schweikhardt.net> writes:
> > -current as of Jun 17, even with an updated sysctl.c revision 1.36,
> > prints garbage when used with -A:
> Remove the line that says "offset--;" near the end of
> sys/vm/vm_zone.c.
Ick, what am I saying - this alone isn't enough, you need to
increment offset after setting *offset to '\0'.
Index: vm_zone.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_zone.c,v
retrieving revision 1.45
diff -u -u -r1.45 vm_zone.c
--- vm_zone.c 2001/07/04 16:20:28 1.45
+++ vm_zone.c 2001/07/09 01:09:51
@@ -451,8 +451,7 @@
offset += len;
}
mtx_unlock(&zone_mtx);
- offset--;
- *offset = '\0';
+ *offset++ = '\0';
error = SYSCTL_OUT(req, tmpbuf, offset - tmpbuf);
out:
FREE(tmpbuf, M_TEMP);
Untested, caveat emptor, etc.
DES
--
Dag-Erling Smorgrav - des@ofug.org
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpvgl2oqig.fsf>
