* grub-core/fs/proc.c: Allow \0 in proc files.

This commit is contained in:
Vladimir Serbinenko 2013-11-12 15:57:09 +01:00
parent ba82db7a0d
commit 3bbeade41d
5 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2013-11-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/fs/proc.c: Allow \0 in proc files.
2013-11-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/tests/xnu_uuid_test.c: Fix assert message.

View File

@ -128,10 +128,11 @@ grub_procfs_open (struct grub_file *file, const char *path)
FOR_LIST_ELEMENTS((entry), (grub_procfs_entries))
if (grub_strcmp (pathptr, entry->name) == 0)
{
file->data = entry->get_contents ();
grub_size_t sz;
file->data = entry->get_contents (&sz);
if (!file->data)
return grub_errno;
file->size = grub_strlen (file->data);
file->size = sz;
return GRUB_ERR_NONE;
}

View File

@ -54,8 +54,9 @@ static const char testfile[] =
;
static char *
get_test_txt (void)
get_test_txt (grub_size_t *sz)
{
*sz = grub_strlen (testfile);
return grub_strdup (testfile);
}

View File

@ -57,8 +57,9 @@ static const char testfile[] =
"timeout=3\n";
static char *
get_test_cfg (void)
get_test_cfg (grub_size_t *sz)
{
*sz = grub_strlen (testfile);
return grub_strdup (testfile);
}

View File

@ -27,7 +27,7 @@ struct grub_procfs_entry
struct grub_procfs_entry **prev;
const char *name;
char * (*get_contents) (void);
char * (*get_contents) (grub_size_t *sz);
};
extern struct grub_procfs_entry *grub_procfs_entries;