OpenCoverage

find-mount-point.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/src/find-mount-point.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8extern char *-
9find_mount_point (char const *file, struct stat const *file_stat)-
10{-
11 struct saved_cwd cwd;-
12 struct stat last_stat;-
13 char *mp = -
14 ((void *)0)-
15 ;-
16-
17 if (save_cwd (&cwd) != 0
save_cwd (&cwd) != 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • df
  • stat
)
0-6
18 {-
19 error (0, -
20 (*__errno_location ())-
21 , -
22 dcgettext (((void *)0), -
23 "cannot get current directory"-
24 , 5)-
25 );-
26 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
27 ((void *)0)
never executed: return ((void *)0) ;
0
28 ;
never executed: return ((void *)0) ;
0
29 }-
30-
31 if (-
32 ((((
(((( file_stat... == (0040000))Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • df
  • stat
FALSEnever evaluated
0-6
33 file_stat->st_mode
(((( file_stat... == (0040000))Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • df
  • stat
FALSEnever evaluated
0-6
34 )) & 0170000) == (0040000))
(((( file_stat... == (0040000))Description
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • df
  • stat
FALSEnever evaluated
0-6
35 )-
36-
37 {-
38 last_stat = *file_stat;-
39 if (chdir (file) < 0
chdir (file) < 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • df
  • stat
)
0-6
40 {-
41 error (0, -
42 (*__errno_location ())-
43 , -
44 dcgettext (((void *)0), -
45 "cannot change to directory %s"-
46 , 5)-
47 , quotearg_style (shell_escape_always_quoting_style, file));-
48 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
49 ((void *)0)
never executed: return ((void *)0) ;
0
50 ;
never executed: return ((void *)0) ;
0
51 }-
52 }
executed 6 times by 2 tests: end of block
Executed by:
  • df
  • stat
6
53 else-
54-
55 {-
56 char *xdir = dir_name (file);-
57 char *dir;-
58 do { dir = -
59 (__extension__ ({ const char *__old = (-
60 xdir-
61 ); size_t __len = strlen (__old) + 1; char *__new = (char *) __builtin_alloca (__len); (char *) memcpy (__new, __old, __len); }))-
62 ; } while (0);-
63 free (xdir);-
64-
65 if (chdir (dir) < 0
chdir (dir) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
66 {-
67 error (0, -
68 (*__errno_location ())-
69 , -
70 dcgettext (((void *)0), -
71 "cannot change to directory %s"-
72 , 5)-
73 , quotearg_style (shell_escape_always_quoting_style, dir));-
74 return
never executed: return ((void *)0) ;
never executed: return ((void *)0) ;
0
75 ((void *)0)
never executed: return ((void *)0) ;
0
76 ;
never executed: return ((void *)0) ;
0
77 }-
78-
79 if (stat (".", &last_stat) < 0
stat (".", &last_stat) < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
80 {-
81 error (0, -
82 (*__errno_location ())-
83 , -
84 dcgettext (((void *)0), -
85 "cannot stat current directory (now %s)"-
86 , 5)-
87 ,-
88 quotearg_style (shell_escape_always_quoting_style, dir));-
89 goto
never executed: goto done;
done;
never executed: goto done;
0
90 }-
91 }
never executed: end of block
0
92-
93-
94-
95-
96 while (-
97 1-
98 )-
99 {-
100 struct stat st;-
101 if (stat ("..", &st) < 0
stat ("..", &st) < 0Description
TRUEnever evaluated
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • df
  • stat
)
0-48
102 {-
103 error (0, -
104 (*__errno_location ())-
105 , -
106 dcgettext (((void *)0), -
107 "cannot stat %s"-
108 , 5)-
109 , quotearg_style (shell_escape_always_quoting_style, ".."));-
110 goto
never executed: goto done;
done;
never executed: goto done;
0
111 }-
112 if (st.st_dev != last_stat.st_dev
st.st_dev != last_stat.st_devDescription
TRUEnever evaluated
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • df
  • stat
|| st.st_ino == last_stat.st_ino
st.st_ino == last_stat.st_inoDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • df
  • stat
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • df
  • stat
)
0-48
113-
114 break;
executed 6 times by 2 tests: break;
Executed by:
  • df
  • stat
6
115 if (chdir ("..") < 0
chdir ("..") < 0Description
TRUEnever evaluated
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • df
  • stat
)
0-42
116 {-
117 error (0, -
118 (*__errno_location ())-
119 , -
120 dcgettext (((void *)0), -
121 "cannot change to directory %s"-
122 , 5)-
123 , quotearg_style (shell_escape_always_quoting_style, ".."));-
124 goto
never executed: goto done;
done;
never executed: goto done;
0
125 }-
126 last_stat = st;-
127 }
executed 42 times by 2 tests: end of block
Executed by:
  • df
  • stat
42
128-
129-
130 mp = xgetcwd ();-
131-
132done:
code before this statement executed 6 times by 2 tests: done:
Executed by:
  • df
  • stat
6
133-
134 {-
135 int save_errno = -
136 (*__errno_location ())-
137 ;-
138 if (restore_cwd (&cwd) != 0
restore_cwd (&cwd) != 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • df
  • stat
)
0-6
139 ((
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
!!sizeof (struct { _Static_assert (
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
140 1
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
141 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
142 1
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
143 ,
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
144 (*__errno_location ())
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
145 ,
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
146 dcgettext (((void *)0),
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
147 "failed to return to initial working directory"
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
148 , 5)
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
149 ), ((
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
150 0
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
151 ) ? (void) 0 : __builtin_unreachable ()))) : ((error (
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
152 1
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
153 ,
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
154 (*__errno_location ())
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
155 ,
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
156 dcgettext (((void *)0),
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
157 "failed to return to initial working directory"
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
158 , 5)
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
159 ), ((
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
160 0
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
161 ) ? (void) 0 : __builtin_unreachable ()))))
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
162 ;
never executed: ((!!sizeof (struct { _Static_assert ( 1 , "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), dcgettext (((void *)0), \"failed to return to initial working directory\", 5)), assume (false))" ")"); int _gl_dummy; })) ? ((error ( 1 , (*__errno_loca... initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ()))) : ((error ( 1 , (*__errno_location ()) , dcgettext (((void *)0), "failed to return to initial working directory" , 5) ), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ;
0
163 free_cwd (&cwd);-
164 -
165 (*__errno_location ()) -
166 = save_errno;-
167 }-
168-
169 return
executed 6 times by 2 tests: return mp;
Executed by:
  • df
  • stat
mp;
executed 6 times by 2 tests: return mp;
Executed by:
  • df
  • stat
6
170}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2