From: Daniel Kahn Gillmor Date: Thu, 29 Apr 2010 14:22:24 +0000 (-0400) Subject: close monkeysphere call, provide scaffolding for marginal UI X-Git-Tag: msva-perl/0.3~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ad4425bea8fa6702943c6aa53be1cd5961593abb;p=monkeysphere-validation-agent.git close monkeysphere call, provide scaffolding for marginal UI --- diff --git a/Changelog b/Changelog index 39e415f..8590c10 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,7 @@ msva-perl (0.3~pre) UNRELEASED; * packaging re-organization + * properly closing piped monkeysphere call -- Daniel Kahn Gillmor Tue, 23 Mar 2010 16:50:07 -0400 diff --git a/msva-perl b/msva-perl index b7b6706..8d7d639 100755 --- a/msva-perl +++ b/msva-perl @@ -365,6 +365,7 @@ use strict; # clean up the path for taint-check mode: $ENV{PATH} = '/usr/local/bin:/usr/bin:/bin'; + # FIXME: should test exit code of open() and do something intelligent with it. open($fh, '-|', 'monkeysphere', 'keys-for-userid', $uid); while(<$fh>) { my @keyinfo = parse_openssh_pubkey($_); @@ -380,6 +381,16 @@ use strict; $ret->{message} = sprintf('Successfully validated "%s" through the OpenPGP Web of Trust.', $uid); } } + my $closeval = close($fh); + my $subproc_retval = POSIX::WEXITSTATUS($?); + if ((!$closeval) && ($! != 0)) { + msvalog('error', "Got bad errno from closing monkeysphere subprocess: %d \n", $!); + } + if ($subproc_retval != 0) { + msvalog('error', "Got bad return code from monkeysphere subprocess: %d \n", $subproc_retval); + # FIXME: marginal UI here? do something with the return code? + } + } } else { msvalog('error', "failed to decode %s\n", unpack('H*', $cert->pubkey()));