2009-11-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
Fix GNU/Hurd grub-install crash. * util/grub-probe.c (probe): Try to access `path' only when it is not NULL.
This commit is contained in:
parent
2f857f9813
commit
dc9837ea5f
2 changed files with 30 additions and 21 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2009-11-29 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||||
|
|
||||||
|
Fix GNU/Hurd grub-install crash.
|
||||||
|
* util/grub-probe.c (probe): Try to access `path' only when it is not
|
||||||
|
NULL.
|
||||||
|
|
||||||
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
|
2009-11-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Correct module naming.
|
Correct module naming.
|
||||||
|
|
|
@ -238,33 +238,36 @@ probe (const char *path, char *device_name)
|
||||||
|
|
||||||
if (print == PRINT_FS)
|
if (print == PRINT_FS)
|
||||||
{
|
{
|
||||||
struct stat st;
|
if (path)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
stat (path, &st);
|
stat (path, &st);
|
||||||
|
|
||||||
if (S_ISREG (st.st_mode))
|
if (S_ISREG (st.st_mode))
|
||||||
{
|
{
|
||||||
/* Regular file. Verify that we can read it properly. */
|
/* Regular file. Verify that we can read it properly. */
|
||||||
|
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
char *rel_path;
|
char *rel_path;
|
||||||
grub_util_info ("reading %s via OS facilities", path);
|
grub_util_info ("reading %s via OS facilities", path);
|
||||||
filebuf_via_sys = grub_util_read_image (path);
|
filebuf_via_sys = grub_util_read_image (path);
|
||||||
|
|
||||||
rel_path = make_system_path_relative_to_its_root (path);
|
rel_path = make_system_path_relative_to_its_root (path);
|
||||||
asprintf (&grub_path, "(%s)%s", drive_name, rel_path);
|
asprintf (&grub_path, "(%s)%s", drive_name, rel_path);
|
||||||
free (rel_path);
|
free (rel_path);
|
||||||
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
||||||
file = grub_file_open (grub_path);
|
file = grub_file_open (grub_path);
|
||||||
if (! file)
|
if (! file)
|
||||||
grub_util_error ("can not open %s via GRUB facilities", grub_path);
|
grub_util_error ("can not open %s via GRUB facilities", grub_path);
|
||||||
filebuf_via_grub = xmalloc (file->size);
|
filebuf_via_grub = xmalloc (file->size);
|
||||||
grub_file_read (file, filebuf_via_grub, file->size);
|
grub_file_read (file, filebuf_via_grub, file->size);
|
||||||
|
|
||||||
grub_util_info ("comparing");
|
grub_util_info ("comparing");
|
||||||
|
|
||||||
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
|
if (memcmp (filebuf_via_grub, filebuf_via_sys, file->size))
|
||||||
grub_util_error ("files differ");
|
grub_util_error ("files differ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("%s\n", fs->name);
|
printf ("%s\n", fs->name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue