Skip to content

Commit

Permalink
bsdinstall: stop messing with file descriptors
Browse files Browse the repository at this point in the history
Throughout the bsdinstall script fd 3 is used by f_dprintf (set through
$TERMINAL_STDOUT_PASSTHRU). By closing file descriptor 3 here, the
final f_dprintf "Installation Completed ... does not work anymore.

By putting the code into a subshell, file descriptors can be edited
without interference with the calling script.

Reviewed by:		emaste
Differential Revision:	https://reviews.freebsd.org/D35113
Sponsored by:		Beckhoff Automation GmbH & Co. KG
MFC after:		3 days

(cherry picked from commit 1f7746d)
  • Loading branch information
Corvin Köhne authored and evadot committed May 16, 2022
1 parent 8c119b3 commit 45eb93a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions usr.sbin/bsdinstall/scripts/script
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,13 @@ fi
bsdinstall mount

# Fetch missing distribution files, if any
exec 3>&1
export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&3)
FETCH_RESULT=$?
exec 3>&-

[ $FETCH_RESULT -ne 0 ] && error "Could not fetch remote distributions"
(
exec 3>&1
export BSDINSTALL_DISTDIR=$(`dirname $0`/fetchmissingdists 2>&1 1>&3)
FETCH_RESULT=$?
exec 3>&-
return $FETCH_RESULT
) || error "Could not fetch remote distributions"

# Unpack distributions
bsdinstall checksum
Expand Down

0 comments on commit 45eb93a

Please sign in to comment.