> Well, I'm less worried about security and also about the fact mktemp is > deprecated so I don't think adding new uses of it is not ideal.
mktemp(3) is not deprecated. It continues to be safe to use for directory creation or other atomic file creations (success or failure; the other party opening it is subject to a race as long as it waits to know that the parent (nc) says it has in fact created it successfully). It is possible to loop. Go through our source tree. There are things calling mktemp(3) on purpose -- in places where mkstemp(3) cannot be used.