From: schwarze Date: Tue, 21 Apr 2015 10:24:22 +0000 (+0000) Subject: When diff(1) finds differences, it returns an exit status of 1. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f3fe92c90f987a8ad7d71dfb52646b676ea4db88;p=openbsd When diff(1) finds differences, it returns an exit status of 1. In that particular case, refrain from printing "diff: exit code 1" because that exit status doesn't indicate an error condition. Issue noticed by and patch OK'ed by ajacoutot@. "I agree with the goal, and I suspect the diff actually achieves it" guenther@. --- diff --git a/libexec/security/security b/libexec/security/security index ef11c0c85e3..65ec816e985 100644 --- a/libexec/security/security +++ b/libexec/security/security @@ -1,6 +1,6 @@ #!/usr/bin/perl -T -# $OpenBSD: security,v 1.34 2015/03/27 13:26:19 schwarze Exp $ +# $OpenBSD: security,v 1.35 2015/04/21 10:24:22 schwarze Exp $ # # Copyright (c) 2011, 2012, 2014, 2015 Ingo Schwarze # Copyright (c) 2011 Andrew Fresh @@ -738,7 +738,11 @@ sub diff { and return; local $/; my $diff = <$fh>; - close_or_nag $fh, "diff"; + { + close $fh and last; + nag $!, "diff: error closing pipe: $!" and last; + nag $? >> 8 > 1, "diff: exit code " . ($? >> 8); + } return nag !!$diff, $diff; }