Date: Tue, 12 Jul 2011 23:39:56 +0000 (UTC) From: "David E. O'Brien" <obrien@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r223969 - stable/8/usr.bin/wall Message-ID: <201107122339.p6CNduKQ059947@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: obrien Date: Tue Jul 12 23:39:56 2011 New Revision: 223969 URL: http://svn.freebsd.org/changeset/base/223969 Log: MFC: r223940: If one's message is longer than the buffer size, then we reset 'cnt' at the wrong point and the actual column # get out of sync across the buffer size. Modified: stable/8/usr.bin/wall/wall.c Directory Properties: stable/8/usr.bin/wall/ (props changed) Modified: stable/8/usr.bin/wall/wall.c ============================================================================== --- stable/8/usr.bin/wall/wall.c Tue Jul 12 21:01:09 2011 (r223968) +++ stable/8/usr.bin/wall/wall.c Tue Jul 12 23:39:56 2011 (r223969) @@ -251,8 +251,9 @@ makemsg(char *fname) err(1, "can't read %s", fname); setegid(egid); } + cnt = 0; while (fgets(lbuf, sizeof(lbuf), stdin)) { - for (cnt = 0, p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) { + for (p = lbuf; (ch = *p) != '\0'; ++p, ++cnt) { if (ch == '\r') { putc('\r', fp); cnt = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107122339.p6CNduKQ059947>