File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -123,14 +123,7 @@ static bool mount_is_loop(const MountParameters *p) {
123123
124124static bool mount_is_bind (const MountParameters * p ) {
125125 assert (p );
126-
127- if (fstab_test_option (p -> options , "bind\0" "rbind\0" ))
128- return true;
129-
130- if (p -> fstype && STR_IN_SET (p -> fstype , "bind" , "rbind" ))
131- return true;
132-
133- return false;
126+ return fstab_is_bind (p -> options , p -> fstype );
134127}
135128
136129static bool mount_is_bound_to_device (Mount * m ) {
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ int fstab_has_fstype(const char *fstype) {
2020 _cleanup_endmntent_ FILE * f = NULL ;
2121 struct mntent * m ;
2222
23+ assert (fstype );
24+
2325 f = setmntent (fstab_path (), "re" );
2426 if (!f )
2527 return errno == ENOENT ? false : - errno ;
@@ -288,3 +290,14 @@ char *fstab_node_to_udev_node(const char *p) {
288290
289291 return strdup (p );
290292}
293+
294+ bool fstab_is_bind (const char * options , const char * fstype ) {
295+
296+ if (fstab_test_option (options , "bind\0" "rbind\0" ))
297+ return true;
298+
299+ if (fstype && STR_IN_SET (fstype , "bind" , "rbind" ))
300+ return true;
301+
302+ return false;
303+ }
Original file line number Diff line number Diff line change @@ -40,3 +40,5 @@ char *fstab_node_to_udev_node(const char *p);
4040static inline const char * fstab_path (void ) {
4141 return secure_getenv ("SYSTEMD_FSTAB" ) ?: "/etc/fstab" ;
4242}
43+
44+ bool fstab_is_bind (const char * options , const char * fstype );
You can’t perform that action at this time.
0 commit comments