LCOV - code coverage report
Current view: top level - shared - apparmor-util.c (source / functions) Hit Total Coverage
Test: systemd_full.info Lines: 6 7 85.7 %
Date: 2019-08-23 13:36:53 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: LGPL-2.1+ */
       2                 :            : 
       3                 :            : #include <stddef.h>
       4                 :            : 
       5                 :            : #include "alloc-util.h"
       6                 :            : #include "apparmor-util.h"
       7                 :            : #include "fileio.h"
       8                 :            : #include "parse-util.h"
       9                 :            : 
      10                 :         12 : bool mac_apparmor_use(void) {
      11                 :            :         static int cached_use = -1;
      12                 :            : 
      13         [ +  + ]:         12 :         if (cached_use < 0) {
      14                 :          8 :                 _cleanup_free_ char *p = NULL;
      15                 :            : 
      16                 :          4 :                 cached_use =
      17         [ -  + ]:          4 :                         read_one_line_file("/sys/module/apparmor/parameters/enabled", &p) >= 0 &&
      18         [ #  # ]:          0 :                         parse_boolean(p) > 0;
      19                 :            :         }
      20                 :            : 
      21                 :         12 :         return cached_use;
      22                 :            : }

Generated by: LCOV version 1.14