unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] nntp: fix printf warnings
@ 2015-11-18 22:58 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-11-18 22:58 UTC (permalink / raw)
  To: meta

Error messages and request lines may contain '%' which would
throw off Perl printf.
---
 lib/PublicInbox/NNTP.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 944e930..0bfafa8 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -114,7 +114,7 @@ sub process_line ($$) {
 	my $err = $@;
 	if ($err && !$self->{closed}) {
 		chomp($l = Dumper(\$l));
-		err($self, "error from: $l ($err)");
+		err($self, 'error from: %s (%s)', $l, $err);
 		$res = '503 program fault - command not performed';
 	}
 	return 0 unless defined $res;
@@ -568,8 +568,8 @@ sub long_response ($$$$) {
 
 			if ($err) {
 				err($self,
-				    "$err during long response[$fd] - %0.6f",
-					now() - $t0);
+				    "%s during long response[$fd] - %0.6f",
+				    $err, now() - $t0);
 			}
 			if ($self->{closed}) {
 				out($self, " deferred[$fd] aborted - %0.6f",
@@ -925,7 +925,7 @@ sub event_read {
 		$r = eval { $self->process_line($line) };
 		my $d = $self->{long_res} ?
 			" deferred[$fd]" : '';
-		out($self, "[$fd] $line - %0.6f$d", now() - $t0);
+		out($self, "[$fd] %s - %0.6f$d", $line, now() - $t0);
 	}
 
 	return $self->close if $r < 0;
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-18 22:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-18 22:58 [PATCH] nntp: fix printf warnings Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).