mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Fix bug in identifying sub-mounts
The code for extracting sub-mounts would just do a STRPREFIX check on the mount. This was flawed because if there were the following mounts /etc/aliases /etc/aliases.db and '/etc/aliases' was asked for, it would return both even though the latter isn't a sub-mount. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@@ -104,6 +104,12 @@ mymain(void)
|
||||
static const char *wantmounts1rev[] = {
|
||||
"/proc/sys/fs/binfmt_misc", "/proc/sys/fs/binfmt_misc", "/proc"
|
||||
};
|
||||
static const char *wantmounts2a[] = {
|
||||
"/etc/aliases"
|
||||
};
|
||||
static const char *wantmounts2b[] = {
|
||||
"/etc/aliases.db"
|
||||
};
|
||||
|
||||
# define DO_TEST_MOUNT_SUBTREE(name, path, prefix, mounts, rev) \
|
||||
do { \
|
||||
@@ -116,6 +122,8 @@ mymain(void)
|
||||
|
||||
DO_TEST_MOUNT_SUBTREE("/proc normal", MTAB_PATH1, "/proc", wantmounts1, false);
|
||||
DO_TEST_MOUNT_SUBTREE("/proc reverse", MTAB_PATH1, "/proc", wantmounts1rev, true);
|
||||
DO_TEST_MOUNT_SUBTREE("/etc/aliases", MTAB_PATH2, "/etc/aliases", wantmounts2a, false);
|
||||
DO_TEST_MOUNT_SUBTREE("/etc/aliases.db", MTAB_PATH2, "/etc/aliases.db", wantmounts2b, false);
|
||||
#endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */
|
||||
|
||||
return ret != 0 ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user