Fix spaces handling in proc/self/mountinfo.
* util/getroot.c (unescape): New function. (grub_find_root_device_from_mountinfo): Use unescape.
This commit is contained in:
parent
ba102053ce
commit
9edd7be26a
2 changed files with 31 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2011-11-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Fix spaces handling in proc/self/mountinfo.
|
||||||
|
|
||||||
|
* util/getroot.c (unescape): New function.
|
||||||
|
(grub_find_root_device_from_mountinfo): Use unescape.
|
||||||
|
|
||||||
2011-11-12 Vladimir Serbinenko <phcoder@gmail.com>
|
2011-11-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Support ZFS embedding.
|
Support ZFS embedding.
|
||||||
|
|
|
@ -129,6 +129,27 @@ struct mountinfo_entry
|
||||||
can't deal with the multiple-device case yet, but in the meantime, we can
|
can't deal with the multiple-device case yet, but in the meantime, we can
|
||||||
at least cope with the single-device case by scanning
|
at least cope with the single-device case by scanning
|
||||||
/proc/self/mountinfo. */
|
/proc/self/mountinfo. */
|
||||||
|
static void
|
||||||
|
unescape (char *str)
|
||||||
|
{
|
||||||
|
char *optr;
|
||||||
|
const char *iptr;
|
||||||
|
for (iptr = optr = str; *iptr; optr++)
|
||||||
|
{
|
||||||
|
if (iptr[0] == '\\' && iptr[1] >= '0' && iptr[1] < '8'
|
||||||
|
&& iptr[2] >= '0' && iptr[2] < '8'
|
||||||
|
&& iptr[3] >= '0' && iptr[3] < '8')
|
||||||
|
{
|
||||||
|
*optr = (((iptr[1] - '0') << 6) | ((iptr[2] - '0') << 3)
|
||||||
|
| (iptr[3] - '0'));
|
||||||
|
iptr += 4;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*optr = *iptr++;
|
||||||
|
}
|
||||||
|
*optr = 0;
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
grub_find_root_device_from_mountinfo (const char *dir, char **relroot)
|
grub_find_root_device_from_mountinfo (const char *dir, char **relroot)
|
||||||
{
|
{
|
||||||
|
@ -165,6 +186,9 @@ grub_find_root_device_from_mountinfo (const char *dir, char **relroot)
|
||||||
entry.enc_root, entry.enc_path, &count) < 6)
|
entry.enc_root, entry.enc_path, &count) < 6)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
unescape (entry.enc_root);
|
||||||
|
unescape (entry.enc_path);
|
||||||
|
|
||||||
enc_path_len = strlen (entry.enc_path);
|
enc_path_len = strlen (entry.enc_path);
|
||||||
/* Check that enc_path is a prefix of dir. The prefix must either be
|
/* 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
|
the entire string, or end with a slash, or be immediately followed
|
||||||
|
|
Loading…
Reference in a new issue