From: Mr NeilBrown Date: Wed, 17 Jun 2020 23:46:39 +0000 (+1000) Subject: LU-10934 tests: fix compilation without SELINUX X-Git-Tag: 2.13.55~95 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=3aa5f8ecf31c29625057c19628d8bfbb3c0c26dc LU-10934 tests: fix compilation without SELINUX lustre/tests/statx.c does not compile is SELINUX support is not installed. So add some #ifdefs to fix it. Test-Parameters: trivial Fixes: 3f7853b31ef6 ("LU-10934 llite: integrate statx() API with Lustre") Signed-off-by: Mr NeilBrown Change-Id: Ia0f285e1bb04270aff753bea71ffbe15a911db5f Reviewed-on: https://review.whamcloud.com/38973 Tested-by: jenkins Reviewed-by: Yingjin Qian Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons --- diff --git a/lustre/tests/statx.c b/lustre/tests/statx.c index eff64f8..a3fbbeb 100644 --- a/lustre/tests/statx.c +++ b/lustre/tests/statx.c @@ -159,9 +159,10 @@ static char const printf_flags[] = "'-+ #0I"; static char const fmt_terse_fs[] = "%n %i %l %t %s %S %b %f %a %c %d\n"; static char const fmt_terse_regular[] = "%n %s %b %f %u %g %D %i %h %t %T" " %X %Y %Z %W %o\n"; +#ifdef HAVE_SELINUX static char const fmt_terse_selinux[] = "%n %s %b %f %u %g %D %i %h %t %T" " %X %Y %Z %W %o %C\n"; - +#endif static char *format; /* Whether to follow symbolic links; True for --dereference (-L). */ @@ -925,8 +926,10 @@ static int out_file_context(char *pformat, size_t prefix_len, strcpy(pformat + prefix_len, "s"); printf(pformat, (scontext ? scontext : "?")); +#ifdef HAVE_SELINUX if (scontext) freecon(scontext); +#endif return rc; } @@ -1291,6 +1294,7 @@ static char *default_format(bool fs, bool terse, bool device) "); free(temp); +#ifdef HAVE_SELINUX if (is_selinux_enabled() > 0) { temp = format; /* TRANSLATORS: This string uses format @@ -1301,7 +1305,7 @@ static char *default_format(bool fs, bool terse, bool device) "Context: %C\n"); free(temp); } - +#endif temp = format; /* TRANSLATORS: This string uses format specifiers from * 'stat --help' without --file-system, and NOT from