* grub-core/osdep/linux/ofpath.c: Check return value of read.
This commit is contained in:
parent
c8a0f1b229
commit
d54f647a4a
2 changed files with 16 additions and 4 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-11-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* grub-core/osdep/linux/ofpath.c: Check return value of read.
|
||||||
|
|
||||||
2013-11-29 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-11-29 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for
|
* util/mkimage.c (grub_install_generate_image): Use grub_crypto_hash for
|
||||||
|
|
|
@ -143,7 +143,12 @@ find_obppath (const char *sysfs_path_orig)
|
||||||
size = st.st_size;
|
size = st.st_size;
|
||||||
of_path = xmalloc (size + MAX_DISK_CAT + 1);
|
of_path = xmalloc (size + MAX_DISK_CAT + 1);
|
||||||
memset(of_path, 0, size + MAX_DISK_CAT + 1);
|
memset(of_path, 0, size + MAX_DISK_CAT + 1);
|
||||||
read(fd, of_path, size);
|
if (read(fd, of_path, size) < 0)
|
||||||
|
{
|
||||||
|
grub_util_info (_("cannot read `%s': %s"), path, strerror (errno));
|
||||||
|
close(fd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
trim_newline(of_path);
|
trim_newline(of_path);
|
||||||
|
@ -353,7 +358,9 @@ check_sas (char *sysfs_path, int *tgt, unsigned long int *sas_address)
|
||||||
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
||||||
|
|
||||||
memset (phy, 0, sizeof (phy));
|
memset (phy, 0, sizeof (phy));
|
||||||
read (fd, phy, sizeof (phy) - 1);
|
if (read (fd, phy, sizeof (phy) - 1) < 0)
|
||||||
|
grub_util_error (_("cannot read `%s': %s"), path, strerror (errno));
|
||||||
|
|
||||||
close (fd);
|
close (fd);
|
||||||
|
|
||||||
sscanf (phy, "%d", tgt);
|
sscanf (phy, "%d", tgt);
|
||||||
|
@ -361,10 +368,11 @@ check_sas (char *sysfs_path, int *tgt, unsigned long int *sas_address)
|
||||||
snprintf (path, path_size, "%s/sas_device/%s/sas_address", p, ed);
|
snprintf (path, path_size, "%s/sas_device/%s/sas_address", p, ed);
|
||||||
fd = open (path, O_RDONLY);
|
fd = open (path, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
grub_util_error (_("cannot open `%s': %s"), path, strerror (errno));
|
||||||
|
|
||||||
memset (phy, 0, sizeof (phy));
|
memset (phy, 0, sizeof (phy));
|
||||||
read (fd, phy, sizeof (phy) - 1);
|
if (read (fd, phy, sizeof (phy) - 1) < 0)
|
||||||
|
grub_util_error (_("cannot read `%s': %s"), path, strerror (errno));
|
||||||
sscanf (phy, "%lx", sas_address);
|
sscanf (phy, "%lx", sas_address);
|
||||||
|
|
||||||
free (path);
|
free (path);
|
||||||
|
|
Loading…
Reference in a new issue