From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 0C2AC633811; Thu, 25 Feb 2016 04:39:27 +0000 (UTC) Date: Thu, 25 Feb 2016 04:39:27 +0000 From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/3] git-http-backend: avoid multi-arg print statemtents Message-ID: <20160225043927.GA14671@dcvr.yhbt.net> References: <20160225040237.29014-1-e@80x24.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160225040237.29014-1-e@80x24.org> List-Id: Even with output buffering disabled via IO::Handle::autoflush, writes are not atomic unless it is a single argument passed to "print". Multiple arguments to "print" will show up as multiple calls to write(2) instead of a single, atomic writev(2). --- lib/PublicInbox/GitHTTPBackend.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm index 9c32535..5879970 100644 --- a/lib/PublicInbox/GitHTTPBackend.pm +++ b/lib/PublicInbox/GitHTTPBackend.pm @@ -139,7 +139,7 @@ sub serve_smart { while (1) { my $r = $input->read($buf, 8192); unless (defined $r) { - $err->print('error reading input: ', $!, "\n"); + $err->print("error reading input: $!\n"); return r(500); } last if ($r == 0); @@ -150,12 +150,12 @@ sub serve_smart { } my ($rpipe, $wpipe); unless (pipe($rpipe, $wpipe)) { - $err->print('error creating pipe', $!, "\n"); + $err->print("error creating pipe: $!\n"); return r(500); } my $pid = fork; # TODO: vfork under Linux... unless (defined $pid) { - $err->print('error forking: ', $!, "\n"); + $err->print("error forking: $!\n"); return r(500); } my $git_dir = $git->{git_dir}; -- EW