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

Function process_dir

src/install.c:382–407  ·  view source on GitHub ↗

Process a command-line file name, for the -d option. */

Source from the content-addressed store, hash-verified

380
381/* Process a command-line file name, for the -d option. */
382static int
383process_dir (char *dir, struct savewd *wd, void *options)
384{
385 struct cp_options const *x = options;
386
387 int ret = (make_dir_parents (dir, wd, make_ancestor, options,
388 dir_mode, announce_mkdir,
389 dir_mode_bits, owner_id, group_id, false)
390 ? EXIT_SUCCESS
391 : EXIT_FAILURE);
392
393 /* FIXME: Due to the current structure of make_dir_parents()
394 we don't have the facility to call defaultcon() before the
395 final component of DIR is created. So for now, create the
396 final component with the context from previous component
397 and here we set the context for the final component. */
398 if (ret == EXIT_SUCCESS && x->set_security_context)
399 {
400 if (! restorecon (x->set_security_context, last_component (dir), false)
401 && ! ignorable_ctx_err (errno))
402 error (0, errno, _("failed to restore context for %s"),
403 quoteaf (dir));
404 }
405
406 return ret;
407}
408
409enum copy_status { COPY_FAILED, COPY_OK, COPY_SKIPPED };
410

Callers

nothing calls this directly

Calls 2

ignorable_ctx_errFunction · 0.85
restoreconFunction · 0.70

Tested by

no test coverage detected