asprintf and snprintf support
This commit is contained in:
parent
c181849b95
commit
8b442f3f4c
60 changed files with 396 additions and 345 deletions
|
@ -197,7 +197,6 @@ grub_scsi_iterate (int (*hook) (const char *name))
|
|||
|
||||
int scsi_iterate (const char *name, int luns)
|
||||
{
|
||||
char sname[40];
|
||||
int i;
|
||||
|
||||
/* In case of a single LUN, just return `usbX'. */
|
||||
|
@ -208,9 +207,13 @@ grub_scsi_iterate (int (*hook) (const char *name))
|
|||
distinguish it. */
|
||||
for (i = 0; i < luns; i++)
|
||||
{
|
||||
grub_sprintf (sname, "%s%c", name, 'a' + i);
|
||||
char *sname;
|
||||
sname = grub_asprintf ("%s%c", name, 'a' + i);
|
||||
if (!sname)
|
||||
return 1;
|
||||
if (hook (sname))
|
||||
return 1;
|
||||
grub_free (sname);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue