]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git-http-backend: avoid multi-arg print statemtents
authorEric Wong <e@80x24.org>
Thu, 25 Feb 2016 04:37:25 +0000 (04:37 +0000)
committerEric Wong <e@80x24.org>
Thu, 25 Feb 2016 04:37:25 +0000 (04:37 +0000)
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

index 9c32535bb70ad414195017729e73fd448d84054e..58799707af73c49bd806eeed6cdcb5e959223993 100644 (file)
@@ -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};