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

Function out_file_context

src/stat.c:835–856  ·  view source on GitHub ↗

Print the context information of FILENAME, and return true iff the context could not be obtained. */

Source from the content-addressed store, hash-verified

833/* Print the context information of FILENAME, and return true iff the
834 context could not be obtained. */
835NODISCARD
836static bool
837out_file_context (char *pformat, size_t prefix_len, char const *filename)
838{
839 char *scontext;
840 bool fail = false;
841
842 if ((follow_links
843 ? getfilecon (filename, &scontext)
844 : lgetfilecon (filename, &scontext)) < 0)
845 {
846 error (0, errno, _("failed to get security context of %s"),
847 quoteaf (filename));
848 scontext = NULL;
849 fail = true;
850 }
851 strcpy (pformat + prefix_len, "s");
852 printf (pformat, (scontext ? scontext : "?"));
853 if (scontext)
854 freecon (scontext);
855 return fail;
856}
857
858/* Print statfs info. Return zero upon success, nonzero upon failure. */
859NODISCARD

Callers 1

print_statFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected