* grub-core/kern/emu/getroot.c (find_root_device_from_mountinfo):
Fix prefix check to handle the case where dir ends with a slash (most significantly, "/" itself). Reported by: Michael Vogt.
This commit is contained in:
parent
b3f8d28ad0
commit
71b6a2b7a2
2 changed files with 12 additions and 1 deletions
|
@ -135,8 +135,12 @@ find_root_device_from_mountinfo (const char *dir)
|
|||
continue; /* only a subtree is mounted */
|
||||
|
||||
enc_path_len = strlen (enc_path);
|
||||
/* Check that enc_path is a prefix of dir. The prefix must either be
|
||||
the entire string, or end with a slash, or be immediately followed
|
||||
by a slash. */
|
||||
if (strncmp (dir, enc_path, enc_path_len) != 0 ||
|
||||
(dir[enc_path_len] && dir[enc_path_len] != '/'))
|
||||
(enc_path_len && dir[enc_path_len - 1] != '/' &&
|
||||
dir[enc_path_len] && dir[enc_path_len] != '/'))
|
||||
continue;
|
||||
|
||||
/* This is a parent of the requested directory. /proc/self/mountinfo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue