Process a command-line file name, for the -d option. */
| 380 | |
| 381 | /* Process a command-line file name, for the -d option. */ |
| 382 | static int |
| 383 | process_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 | |
| 409 | enum copy_status { COPY_FAILED, COPY_OK, COPY_SKIPPED }; |
| 410 |
nothing calls this directly
no test coverage detected