HomeFreeBSD

install: Simplify path construction.

Description

install: Simplify path construction.

There's no need to copy the path twice to split it into base and dir.
We simply call basename() first, then handle the two trivial cases in
which it isn't safe to call dirname().

While here, add an early check that the destination is not an empty
string. This would always fail eventually, so it may as well fail
right away. Also add a test case for this shortcut.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44743

Details

Provenance
desAuthored on Apr 12 2024, 5:30 PM
Reviewer
markj
Differential Revision
D44743: install: Simplify path construction.
Parents
rGe5035d08578e: install: Always use a temporary file.
Branches
Unknown
Tags
Unknown