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

Function install_file_in_file

src/install.c:716–741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

714 Return true if successful. */
715
716static bool
717install_file_in_file (char const *from, char const *to,
718 int to_dirfd, char const *to_relname,
719 const struct cp_options *x)
720{
721 struct stat from_sb;
722 if (x->preserve_timestamps && stat (from, &from_sb) != 0)
723 {
724 error (0, errno, _("cannot stat %s"), quoteaf (from));
725 return false;
726 }
727 enum copy_status copy_status = copy_file (from, to, to_dirfd, to_relname, x);
728 if (copy_status == COPY_FAILED)
729 return false;
730 if (copy_status == COPY_OK && strip_files && ! strip (to))
731 {
732 if (unlinkat (to_dirfd, to_relname, 0) != 0) /* Cleanup. */
733 error (EXIT_FAILURE, errno, _("cannot unlink %s"), quoteaf (to));
734 return false;
735 }
736 if (x->preserve_timestamps && (copy_status == COPY_SKIPPED || strip_files
737 || ! S_ISREG (from_sb.st_mode))
738 && ! change_timestamps (&from_sb, to, to_dirfd, to_relname))
739 return false;
740 return change_attributes (to, to_dirfd, to_relname);
741}
742
743/* Create any missing parent directories of TO,
744 while maintaining the current Working Directory.

Callers 3

install_file_in_dirFunction · 0.85
mainFunction · 0.85

Calls 5

copy_fileFunction · 0.85
stripFunction · 0.85
change_timestampsFunction · 0.85
change_attributesFunction · 0.85
statClass · 0.70

Tested by

no test coverage detected