From owner-freebsd-current Sat Feb 8 13: 8:35 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C9CE37B401 for ; Sat, 8 Feb 2003 13:08:33 -0800 (PST) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0B37643FA3 for ; Sat, 8 Feb 2003 13:08:33 -0800 (PST) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 45B2FAE165; Sat, 8 Feb 2003 13:08:24 -0800 (PST) Date: Sat, 8 Feb 2003 13:08:24 -0800 From: Alfred Perlstein To: current@freebsd.org Subject: syslog bug Message-ID: <20030208210824.GK88781@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG syslog(3) botches things if you pass it a string that has "%%m" in it. this should fix it, any comments? Index: syslog.c =================================================================== RCS file: /home/ncvs/src/lib/libc/gen/syslog.c,v retrieving revision 1.28 diff -u -r1.28 syslog.c --- syslog.c 14 Nov 2002 12:40:14 -0000 1.28 +++ syslog.c 8 Feb 2003 21:08:09 -0000 @@ -190,12 +190,18 @@ } /* Substitute error message for %m. */ - for ( ; (ch = *fmt); ++fmt) + for ( ; (ch = *fmt); ++fmt) { if (ch == '%' && fmt[1] == 'm') { ++fmt; fputs(strerror(saved_errno), fmt_fp); - } else + } else if (ch == '%' && fmt[1] == '%') { + ++fmt; + fputc(ch, fmt_fp); + fputc(ch, fmt_fp); + } else { fputc(ch, fmt_fp); + } + } /* Null terminate if room */ fputc(0, fmt_fp); -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message