File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1906,14 +1906,19 @@ struct xccdf_rule_result_iterator *xccdf_session_get_rule_results(const struct x
19061906 return xccdf_result_get_rule_results (session -> xccdf .result );
19071907}
19081908
1909- static int system_is_in_bootc_mode (void )
1909+ static bool _system_is_in_bootc_mode (void )
19101910{
19111911#ifdef OS_WINDOWS
1912- return 0 ;
1912+ return false ;
19131913#else
1914- FILE * output = popen ("bootc status --format json 2>/dev/null | jq \".status.booted\" 2>/dev/null" , "r" );
1914+ #define BOOTC_PATH "/usr/bin/bootc"
1915+ struct stat statbuf ;
1916+ if (stat (BOOTC_PATH , & statbuf ) == -1 ) {
1917+ return false;
1918+ }
1919+ FILE * output = popen (BOOTC_PATH " status --format json 2>/dev/null" , "r" );
19151920 if (output == NULL ) {
1916- return 0 ;
1921+ return false ;
19171922 }
19181923 char buf [1024 ] = {0 };
19191924 int c ;
@@ -1923,7 +1928,7 @@ static int system_is_in_bootc_mode(void)
19231928 i ++ ;
19241929 }
19251930 pclose (output );
1926- return * buf != '\0' && strcmp (buf , "null\n" ) != 0 ;
1931+ return * buf != '\0' && strstr (buf , "\"status:\"null" ) == NULL ;
19271932#endif
19281933}
19291934
@@ -1938,7 +1943,7 @@ int xccdf_session_remediate(struct xccdf_session *session)
19381943 oscap_seterr (OSCAP_EFAMILY_OSCAP , "Can't perform remediation in offline mode: not implemented" );
19391944 return 1 ;
19401945 }
1941- if (system_is_in_bootc_mode ()) {
1946+ if (_system_is_in_bootc_mode ()) {
19421947 oscap_seterr (OSCAP_EFAMILY_OSCAP ,
19431948 "Detected running Image Mode operating system. OpenSCAP can't "
19441949 "perform remediation of this system because majority of the "
You can’t perform that action at this time.
0 commit comments