OpenCoverage

readutmp.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/readutmp.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10-
11-
12char *-
13extract_trimmed_name (const STRUCT_UTMP *ut)-
14{-
15 char *p, *trimmed_name;-
16-
17 trimmed_name = xmalloc (sizeof (((ut)->-
18 ut_user-
19 )) + 1);-
20 strncpy (trimmed_name, ((ut)->-
21 ut_user-
22 ), sizeof (((ut)->-
23 ut_user-
24 )));-
25-
26-
27-
28 trimmed_name[sizeof (((ut)->-
29 ut_user-
30 ))] = '\0';-
31 for (p = trimmed_name + strlen (trimmed_name);-
32 trimmed_name < p
trimmed_name < pDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • users
FALSEnever evaluated
&& p[-1] == ' '
p[-1] == ' 'Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • users
;
0-1
33 *--p = '\0')-
34 continue;
never executed: continue;
0
35 return
executed 1 time by 1 test: return trimmed_name;
Executed by:
  • users
trimmed_name;
executed 1 time by 1 test: return trimmed_name;
Executed by:
  • users
1
36}-
37-
38-
39-
40static -
41 _Bool-
42-
43desirable_utmp_entry (STRUCT_UTMP const *u, int options)-
44{-
45 -
46 _Bool -
47 user_proc = (((
((u)-> ut_user )[0]Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEnever evaluated
u)->
((u)-> ut_user )[0]Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEnever evaluated
0-12
48 ut_user
((u)-> ut_user )[0]Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEnever evaluated
0-12
49 )[0]
((u)-> ut_user )[0]Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEnever evaluated
&& (((
((u)->ut_type == ( 7 ))Description
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
u)->ut_type == (
((u)->ut_type == ( 7 ))Description
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
0-12
50 7
((u)->ut_type == ( 7 ))Description
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
3-9
51 ))
((u)->ut_type == ( 7 ))Description
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEevaluated 9 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
|| (0 && ((
dead code: ((u)->ut_tv.tv_sec) != 0
u)->ut_tv.tv_sec) != 0
dead code: ((u)->ut_tv.tv_sec) != 0
)));
-
52 if ((
(options & REA..._USER_PROCESS)Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
options & READ_UTMP_USER_PROCESS)
(options & REA..._USER_PROCESS)Description
TRUEnever evaluated
FALSEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
&& !user_proc
!user_procDescription
TRUEnever evaluated
FALSEnever evaluated
)
0-12
53 return
never executed: return 0 ;
never executed: return 0 ;
0
54 0
never executed: return 0 ;
0
55 ;
never executed: return 0 ;
0
56 if ((
(options & REA...MP_CHECK_PIDS)Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • users
  • who
FALSEevaluated 4 times by 1 test
Evaluated by:
  • pinky
options & READ_UTMP_CHECK_PIDS)
(options & REA...MP_CHECK_PIDS)Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • users
  • who
FALSEevaluated 4 times by 1 test
Evaluated by:
  • pinky
4-8
57 && user_proc
user_procDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • users
  • who
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • users
  • who
2-6
58 && 0 < ((u)->ut_pid)
0 < ((u)->ut_pid)Description
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • users
  • who
FALSEnever evaluated
0-2
59 && (kill (((u)->ut_pid), 0) < 0
kill (((u)->ut_pid), 0) < 0Description
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • users
  • who
&&
0-2
60 (*
(*__errno_location ()) == 3Description
TRUEnever evaluated
FALSEnever evaluated
__errno_location ())
(*__errno_location ()) == 3Description
TRUEnever evaluated
FALSEnever evaluated
0
61 ==
(*__errno_location ()) == 3Description
TRUEnever evaluated
FALSEnever evaluated
0
62 3
(*__errno_location ()) == 3Description
TRUEnever evaluated
FALSEnever evaluated
0
63 ))-
64 return
never executed: return 0 ;
never executed: return 0 ;
0
65 0
never executed: return 0 ;
0
66 ;
never executed: return 0 ;
0
67 return
executed 12 times by 3 tests: return 1 ;
Executed by:
  • pinky
  • users
  • who
executed 12 times by 3 tests: return 1 ;
Executed by:
  • pinky
  • users
  • who
12
68 1
executed 12 times by 3 tests: return 1 ;
Executed by:
  • pinky
  • users
  • who
12
69 ;
executed 12 times by 3 tests: return 1 ;
Executed by:
  • pinky
  • users
  • who
12
70}-
71int-
72read_utmp (char const *file, size_t *n_entries, STRUCT_UTMP **utmp_buf,-
73 int options)-
74{-
75 size_t n_read = 0;-
76 size_t n_alloc = 0;-
77 STRUCT_UTMP *utmp = -
78 ((void *)0)-
79 ;-
80 STRUCT_UTMP *u;-
81-
82-
83-
84-
85-
86 utmpxname ((char *) file);-
87-
88 setutxent ();-
89-
90 while ((
(u = getutxent...!= ((void *)0)Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEevaluated 3 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
u = getutxent ()) !=
(u = getutxent...!= ((void *)0)Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEevaluated 3 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
3-12
91 ((void *)0)
(u = getutxent...!= ((void *)0)Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEevaluated 3 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
3-12
92 )-
93 if (desirable_utmp_entry (u, options)
desirable_utmp...y (u, options)Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEnever evaluated
)
0-12
94 {-
95 if (n_read == n_alloc
n_read == n_allocDescription
TRUEevaluated 9 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
FALSEevaluated 3 times by 3 tests
Evaluated by:
  • pinky
  • users
  • who
)
3-9
96 utmp = x2nrealloc (utmp, &n_alloc, sizeof *utmp);
executed 9 times by 3 tests: utmp = x2nrealloc (utmp, &n_alloc, sizeof *utmp);
Executed by:
  • pinky
  • users
  • who
9
97-
98 utmp[n_read++] = *u;-
99 }
executed 12 times by 3 tests: end of block
Executed by:
  • pinky
  • users
  • who
12
100-
101 endutxent ();-
102-
103 *n_entries = n_read;-
104 *utmp_buf = utmp;-
105-
106 return
executed 3 times by 3 tests: return 0;
Executed by:
  • pinky
  • users
  • who
0;
executed 3 times by 3 tests: return 0;
Executed by:
  • pinky
  • users
  • who
3
107}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2