tee: minor cleanup
Pull the open flags out of the loop into a local var. They won't be
changing, so this is marginally more readable.
Adds some extra brackets around the loop in preparation for a future
change that may try to fallback to opening the path as a socket if we
get an EOPNOTSUPP.
No functional change.
Reviewed by: asomers, des, emaste, ngie
(cherry picked from commit 414c2b8d1e5abe7186c1aa4dc3ab28147ce46f47)