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.