File tree 1 file changed +11
-6
lines changed
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
1906
1906
return xccdf_result_get_rule_results (session -> xccdf .result );
1907
1907
}
1908
1908
1909
- static int system_is_in_bootc_mode (void )
1909
+ static bool _system_is_in_bootc_mode (void )
1910
1910
{
1911
1911
#ifdef OS_WINDOWS
1912
- return 0 ;
1912
+ return false ;
1913
1913
#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" );
1915
1920
if (output == NULL ) {
1916
- return 0 ;
1921
+ return false ;
1917
1922
}
1918
1923
char buf [1024 ] = {0 };
1919
1924
int c ;
@@ -1923,7 +1928,7 @@ static int system_is_in_bootc_mode(void)
1923
1928
i ++ ;
1924
1929
}
1925
1930
pclose (output );
1926
- return * buf != '\0' && strcmp (buf , "null\n" ) != 0 ;
1931
+ return * buf != '\0' && strstr (buf , "\"status:\"null" ) == NULL ;
1927
1932
#endif
1928
1933
}
1929
1934
@@ -1938,7 +1943,7 @@ int xccdf_session_remediate(struct xccdf_session *session)
1938
1943
oscap_seterr (OSCAP_EFAMILY_OSCAP , "Can't perform remediation in offline mode: not implemented" );
1939
1944
return 1 ;
1940
1945
}
1941
- if (system_is_in_bootc_mode ()) {
1946
+ if (_system_is_in_bootc_mode ()) {
1942
1947
oscap_seterr (OSCAP_EFAMILY_OSCAP ,
1943
1948
"Detected running Image Mode operating system. OpenSCAP can't "
1944
1949
"perform remediation of this system because majority of the "
You can’t perform that action at this time.
0 commit comments