From: espie Date: Sun, 31 Jan 2021 15:22:55 +0000 (+0000) Subject: turns out STDOUT may have been redirected, in which case tcgetpgrp will X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7d028f8057c14609007b0bb995bd96865afd6322;p=openbsd turns out STDOUT may have been redirected, in which case tcgetpgrp will return -1, in which case we never need to suppress output. noticed by Mark Patruck --- diff --git a/usr.sbin/pkg_add/OpenBSD/State.pm b/usr.sbin/pkg_add/OpenBSD/State.pm index 8750341bfd7..1a26a9a471b 100644 --- a/usr.sbin/pkg_add/OpenBSD/State.pm +++ b/usr.sbin/pkg_add/OpenBSD/State.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: State.pm,v 1.67 2021/01/30 11:19:01 espie Exp $ +# $OpenBSD: State.pm,v 1.68 2021/01/31 15:22:55 espie Exp $ # # Copyright (c) 2007-2014 Marc Espie # @@ -142,8 +142,11 @@ sub handle_continue OpenBSD::Auto::cache(can_output, sub { require POSIX; + # XXX uses POSIX semantics so fd, we can hardcode stdout ;) - return getpgrp() == POSIX::tcgetpgrp(1); + my $s = POSIX::tcgetpgrp(1); + # note that STDOUT may be redirected (tcgetpgrp() will fail) + return $s == -1 || getpgrp() == $s; }); sub sync_display