HomeFreeBSD

mktemp: don't double up on trailing slashes for -t paths

Description

mktemp: don't double up on trailing slashes for -t paths

This is a minor cosmetic change; re-organize slightly to set tmpdir to
_PATH_TMP if we didn't otherwise have a tmpdir candidate, then check the
trailing char before appending another slash.

While we're here, remove some bogus whitespace and add a test case for
this change.

Obtained from: https://github.com/apple-oss-distributions/shell_cmds
Sponsored by: Klara, Inc.

(cherry picked from commit a6346c02f646c6b74f007c64a9b546deb06182ae)

Details

Provenance
kevansAuthored on Nov 2 2022, 8:29 PM
Parents
rG30697383812e: mktemp: add -p/--tmpdir argument
Branches
Unknown
Tags
Unknown