diff options
Diffstat (limited to 'bin/cp/extern.h')
-rw-r--r-- | bin/cp/extern.h | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/bin/cp/extern.h b/bin/cp/extern.h index 65360ccaf6c1..683e6e5f289f 100644 --- a/bin/cp/extern.h +++ b/bin/cp/extern.h @@ -27,28 +27,38 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)extern.h 8.2 (Berkeley) 4/1/94 - * $FreeBSD$ */ typedef struct { - char *p_end; /* pointer to NULL at end of path */ - char *target_end; /* pointer to end of target base */ - char p_path[PATH_MAX]; /* pointer to the start of a path */ + int dir; /* base directory handle */ + char base[PATH_MAX + 1]; /* base directory path */ + char *end; /* pointer to NUL at end of path */ + char path[PATH_MAX]; /* target path */ } PATH_T; extern PATH_T to; -extern int fflag, iflag, lflag, nflag, pflag, sflag, vflag; +extern bool Nflag, fflag, iflag, lflag, nflag, pflag, sflag, vflag; extern volatile sig_atomic_t info; __BEGIN_DECLS -int copy_fifo(struct stat *, int); -int copy_file(const FTSENT *, int); -int copy_link(const FTSENT *, int); -int copy_special(struct stat *, int); -int setfile(struct stat *, int); -int preserve_dir_acls(struct stat *, char *, char *); +int copy_fifo(struct stat *, bool, bool); +int copy_file(const FTSENT *, bool, bool); +int copy_link(const FTSENT *, bool, bool); +int copy_special(struct stat *, bool, bool); +int setfile(struct stat *, int, bool); +int preserve_dir_acls(const char *, const char *); int preserve_fd_acls(int, int); -void usage(void); +void usage(void) __dead2; __END_DECLS + +/* + * The FreeBSD and Darwin kernels return ENOTCAPABLE when a path lookup + * violates a RESOLVE_BENEATH constraint. This results in confusing error + * messages, so translate it to the more widely recognized EACCES. + */ +#ifdef ENOTCAPABLE +#define warn(...) \ + warnc(errno == ENOTCAPABLE ? EACCES : errno, __VA_ARGS__) +#define err(rv, ...) \ + errc(rv, errno == ENOTCAPABLE ? EACCES : errno, __VA_ARGS__) +#endif |