MCPcopy Create free account
hub / github.com/coreutils/coreutils / copy_attr

Function copy_attr

src/copy.c:322–352  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320 then copy by fd, otherwise copy by name. */
321
322static bool
323copy_attr (char const *src_path, int src_fd,
324 char const *dst_path, int dst_fd, struct cp_options const *x)
325{
326 bool all_errors = (!x->data_copy_required || x->require_preserve_xattr);
327 bool some_errors = (!all_errors && !x->reduce_diagnostics);
328 int (*check) (char const *, struct error_context *)
329 = (x->preserve_security_context || x->set_security_context
330 ? check_selinux_attr : NULL);
331
332# if 4 < __GNUC__ + (8 <= __GNUC_MINOR__)
333 /* Pacify gcc -Wsuggest-attribute=format through at least GCC 13.2.1. */
334# pragma GCC diagnostic push
335# pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
336# endif
337 struct error_context *ctx
338 = (all_errors || some_errors
339 ? (&(struct error_context) {
340 .error = all_errors ? copy_attr_allerror : copy_attr_error,
341 .quote = copy_attr_quote,
342 .quote_free = copy_attr_free
343 })
344 : NULL);
345# if 4 < __GNUC__ + (8 <= __GNUC_MINOR__)
346# pragma GCC diagnostic pop
347# endif
348
349 return ! (0 <= src_fd && 0 <= dst_fd
350 ? attr_copy_fd (src_path, src_fd, dst_path, dst_fd, check, ctx)
351 : attr_copy_file (src_path, dst_path, check, ctx));
352}
353#else /* USE_XATTR */
354
355static bool

Callers 2

copy_regFunction · 0.85
copy_internalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected