ref: 840ade48c4e2c309a9f0ef02a939e00da4c0ee90
parent: 4616c93e8d5fbb9fbedf3b2c16f5b86a21e834ac
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Oct 29 13:29:09 EDT 2014
fix syslog() use with linefeeds for various programs
--- a/sys/src/cmd/auth/secstore/secstored.c
+++ b/sys/src/cmd/auth/secstore/secstored.c
@@ -143,7 +143,7 @@
snprint(s, Maxmsg, "%s/store/%s/%s", SECSTORE_DIR, id, pf);
pd = create(s, OWRITE, 0660);
if(pd < 0){
- syslog(0, LOG, "can't open %s: %r\n", s);
+ syslog(0, LOG, "can't open %s: %r", s);
return -1;
}
while(len > 0){
--- a/sys/src/cmd/auth/secureidcheck.c
+++ b/sys/src/cmd/auth/secureidcheck.c
@@ -397,7 +397,7 @@
shared.len = strlen(radiussecret);
ip = getipv4addr();
if(ip == nil){
- syslog(0, AUTHLOG, "no interfaces: %r\n");
+ syslog(0, AUTHLOG, "no interfaces: %r");
goto out;
}
if(setAttribute(req, R_NASIPAddress, ip + IPv4off, 4) < 0)
@@ -413,7 +413,7 @@
t = ndbsearch(netdb, &s, "sys", "lra-radius");
if(t == nil){
- syslog(0, AUTHLOG, "secureidcheck: nil radius sys search: %r\n");
+ syslog(0, AUTHLOG, "secureidcheck: nil radius sys search: %r");
goto out;
}
for(nt = t; nt; nt = nt->entry){
--- a/sys/src/cmd/cfs/cfs.c
+++ b/sys/src/cmd/cfs/cfs.c
@@ -634,7 +634,7 @@
b->inode.length = c.thdr.offset + s.rhdr.count;
mf->qid.vers++;
if (s.rhdr.count != c.thdr.count)
- syslog(0, "cfslog", "rhdr.count %ud, thdr.count %ud\n",
+ syslog(0, "cfslog", "rhdr.count %ud, thdr.count %ud",
s.rhdr.count, c.thdr.count);
if(fwrite(&ic, b, buf, c.thdr.offset, s.rhdr.count) == s.rhdr.count){
iinc(&ic, b);
--- a/sys/src/cmd/ip/dhcpd/db.c
+++ b/sys/src/cmd/ip/dhcpd/db.c
@@ -261,7 +261,7 @@
/* complain if we haven't in the last 5 minutes */
if(now - b->lastcomplained < 5*60)
return;
- syslog(0, blog, "dhcp: lease for %I to %s ended at %ld but still in use\n",
+ syslog(0, blog, "dhcp: lease for %I to %s ended at %ld but still in use",
b->ip, b->boundto != nil ? b->boundto : "?", b->lease);
b->lastcomplained = now;
}
--- a/sys/src/cmd/ip/ppp/mppc.c
+++ b/sys/src/cmd/ip/ppp/mppc.c
@@ -487,7 +487,7 @@
*protop = 0;
s = ppp->uncstate;
if(BLEN(b) < 2){
- syslog(0, "ppp", ": mppc: short packet\n");
+ syslog(0, "ppp", ": mppc: short packet");
freeb(b);
return nil;
}
@@ -506,7 +506,7 @@
}
if(BLEN(b) < 2){
- syslog(0, "ppp", ": mppc: short packet\n");
+ syslog(0, "ppp", ": mppc: short packet");
freeb(b);
*protop = 0;
return nil;
--- a/sys/src/cmd/ip/ppp/ppp.c
+++ b/sys/src/cmd/ip/ppp/ppp.c
@@ -1346,11 +1346,11 @@
break;
case Lcoderej:
//newstate(ppp, p, Sclosed);
- syslog(0, LOG, "code reject %d\n", m->data[0]);
+ syslog(0, LOG, "code reject %d", m->data[0]);
break;
case Lprotorej:
proto = nhgets(m->data);
- netlog("ppp: proto reject %ux\n", proto);
+ netlog("ppp: proto reject %ux", proto);
if(proto == Pccp)
newstate(ppp, ppp->ccp, Sclosed);
break;
@@ -2218,7 +2218,7 @@
netlog("ppp: chap failed\n");
break;
default:
- syslog(0, LOG, "chap code %d?\n", m->code);
+ syslog(0, LOG, "chap code %d?", m->code);
break;
}
qunlock(ppp);
--- a/sys/src/cmd/ip/ppp/thw.c
+++ b/sys/src/cmd/ip/ppp/thw.c
@@ -253,7 +253,7 @@
uncs = ppp->uncstate;
if(BLEN(bb) < 4){
- syslog(0, "ppp", ": thwack: short packet\n");
+ syslog(0, "ppp", ": thwack: short packet");
freeb(bb);
return nil;
}
@@ -279,7 +279,7 @@
n = unthwack(&uncs->ut, b->wptr, ThwMaxBlock, bb->rptr, BLEN(bb), seq & ThwSeqMask);
freeb(bb);
if(n < 2){
- syslog(0, "ppp", ": unthwack: short or corrupted packet %d seq=%ld\n", n, seq);
+ syslog(0, "ppp", ": unthwack: short or corrupted packet %d seq=%ld", n, seq);
netlog("unthwack: short or corrupted packet n=%d seq=%ld: %s\n", n, seq, uncs->ut.err);
freeb(b);
--- a/sys/src/cmd/telco/telco.c
+++ b/sys/src/cmd/telco/telco.c
@@ -1452,7 +1452,7 @@
argv[argc++] = dev->t->name;
argv[argc] = 0;
exec(prog, argv);
- syslog(0, LOGFILE, "can't exec %s: %r\n", prog);
+ syslog(0, LOGFILE, "can't exec %s: %r", prog);
exits(0);
default:
/* wait till child gets the device open */
--- a/sys/src/cmd/upas/q/qer.c
+++ b/sys/src/cmd/upas/q/qer.c
@@ -131,7 +131,7 @@
while((n = read(0, buf, sizeof(buf)-1)) > 0){
if(i++ == 0 && strncmp(buf, "From", 4) != 0){
buf[n] = 0;
- syslog(0, "smtp", "qer usys data starts with %-40.40s\n", buf);
+ syslog(0, "smtp", "qer usys data starts with %-40.40s", buf);
}
if(write(fd, buf, n) != n)
error("writing data file %s", s_to_c(f));
--- a/sys/src/cmd/upas/q/runq.c
+++ b/sys/src/cmd/upas/q/runq.c
@@ -517,7 +517,7 @@
if(wm->msg[0]){
if(debug)
fprint(2, "[%d] wm->msg == %s\n", getpid(), wm->msg);
- syslog(0, runqlog, "message: %s\n", wm->msg);
+ syslog(0, runqlog, "message: %s", wm->msg);
if(strstr(wm->msg, "Ignore") != nil){
/* fix for fish/chips, leave message alone */
logit("ignoring", dp->name, av);