* commands/i386/pc/play.c (grub_cmd_play): Call 'grub_file_open' only

if argc is 1.
This commit is contained in:
Samuel Thibault 2010-04-28 23:18:16 +02:00
parent bb06ba0892
commit c76a18386f
2 changed files with 9 additions and 3 deletions

View file

@ -1,6 +1,8 @@
2010-04-28 Samuel Thibault <samuel.thibault@ens-lyon.org> 2010-04-28 Samuel Thibault <samuel.thibault@ens-lyon.org>
* docs/grub.texi (play): Document that zero pitches produce rests. * docs/grub.texi (play): Document that zero pitches produce rests.
* commands/i386/pc/play.c (grub_cmd_play): Call 'grub_file_open' only
if argc is 1.
2010-04-27 Vladimir Serbinenko <phcoder@gmail.com> 2010-04-27 Vladimir Serbinenko <phcoder@gmail.com>

View file

@ -177,16 +177,20 @@ static grub_err_t
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
int argc, char **args) int argc, char **args)
{ {
grub_file_t file;
if (argc < 1) if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required"); return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required");
file = grub_file_open (args[0]); if (argc == 1)
if (file)
{ {
struct note buf; struct note buf;
grub_uint32_t tempo; grub_uint32_t tempo;
grub_file_t file;
file = grub_file_open (args[0]);
if (! file)
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo)) if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
{ {