HomeFreeBSD

bsdinstall: avoid conflicts with fd 3

Description

bsdinstall: avoid conflicts with fd 3

Throughout the bsdinstall script fd 3 is used by f_dprintf (set through
$TERMINAL_STDOUT_PASSTHRU). In several places in the bsdinstalls scripts,
we use fd 3 to juggle stdout when calling out to other tools, which can
cause the installer to fail with a "Bad file descriptor" error when
f_dprintf attempts to use it.

This commit replaces all constructs like this:

exec 3>&1
SOME_VARIABLE=$(some command 2>&1 1>&3)
exec 3>&-

With:

exec 5>&1
SOME_VARIABLE=$(some command 2>&1 1>&5)
exec 5>&-

PR: 273148
Reviewed by: corvink
Fixes: 1f7746d81f53447ac15cc99395bb714d4dd0a4da ("bsdinstall: stop messing with file descriptors")
MFC after: 1 week

Details

Provenance
Lars Kellogg-Stedman <lars@oddbit.com>Authored on Aug 15 2023, 3:44 PM
corvinkCommitted on Sep 21 2023, 6:41 AM
Parents
rGcf7974fd9e55: sysctl: Update 'master' copy of vnet SYSCTLs on kernel environment variables…
Branches
Unknown
Tags
Unknown

Event Timeline