]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cp: Refactor the core logic.
authorDag-Erling Smørgrav <des@FreeBSD.org>
Wed, 13 Dec 2023 23:40:45 +0000 (00:40 +0100)
committerDag-Erling Smørgrav <des@FreeBSD.org>
Wed, 13 Dec 2023 23:40:55 +0000 (00:40 +0100)
commitd002316fd7bf0b359ea2f5518f3c10f6ad89a9ac
treef1d2f1a60601ffb45f8aefd0592ad00f01ad27d5
parentd3a8e9b43b4cef5b80e3845dfa8fd1fec6e568f9
cp: Refactor the core logic.

Rewrite `copy_file()` so the lflag and sflag are handled as early as
possible instead of constantly checking that they're not set and then
handling them at the end.  This also opens the door to changing the
failure logic at some future point (for instance, we might decide to
fall back to copying if `errno` indicates that the file system does not
support links).

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans, allanjude
Differential Revision: https://reviews.freebsd.org/D43055
bin/cp/utils.c