aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2017-07-23 14:47:52 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2017-07-23 14:47:52 +0300
commit1718b7e87b3ce2d588f2412ac41bea6e7048709f (patch)
tree07e1ff5864cd8b323f7720e02c8988e4b7366462
parent6ffdc2c388a93365c4ec0ee5cb37296b120b2e3c (diff)
downloadposixruncapture-1718b7e87b3ce2d588f2412ac41bea6e7048709f.tar.gz
posixruncapture-1718b7e87b3ce2d588f2412ac41bea6e7048709f.tar.bz2
Change return value of capture_run to conform to Perl convention
* capture.c (capture_run): Return true on success. * t/TestCapture.pm: Expect true on success
-rw-r--r--capture.c13
-rw-r--r--t/TestCapture.pm2
2 files changed, 7 insertions, 8 deletions
diff --git a/capture.c b/capture.c
index f22fc9f..7b2bf9a 100644
--- a/capture.c
+++ b/capture.c
@@ -168,13 +168,12 @@ capture_DESTROY(struct capture *cp)
if (cp->program != &PL_sv_undef)
SvREFCNT_dec(cp->program);
- if (cp->input != &PL_sv_undef) {
+ if (cp->input != &PL_sv_undef)
SvREFCNT_dec(cp->input);
- /* Make sure runcap_free won't free the input sc_base pointer
- */
- cp->rc.rc_cap[RUNCAP_STDIN].sc_base = NULL;
- cp->rc.rc_cap[RUNCAP_STDIN].sc_fd = -1;
- }
+ /* Make sure runcap_free won't free the input sc_base pointer
+ */
+ cp->rc.rc_cap[RUNCAP_STDIN].sc_base = NULL;
+ cp->rc.rc_cap[RUNCAP_STDIN].sc_fd = -1;
free(cp->closure[0].str);
if (cp->closure[0].cv != &PL_sv_undef)
@@ -278,6 +277,6 @@ capture_run(struct capture *cp)
cp->closure[1].len = 0;
}
- return res;
+ return res == 0;
}
diff --git a/t/TestCapture.pm b/t/TestCapture.pm
index c7f31e3..8e8bf95 100644
--- a/t/TestCapture.pm
+++ b/t/TestCapture.pm
@@ -52,7 +52,7 @@ sub test_stream {
sub TestCapture {
my ($argv, %kw) = @_;
- $kw{result} = 0 unless exists $kw{result};
+ $kw{result} = 1 unless exists $kw{result};
$kw{code} = 0 unless exists $kw{code};
my $cap;

Return to:

Send suggestions and report system problems to the System administrator.