From c76a18386f45b0bc1dc8ef4d69f1210a4bde60c7 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Wed, 28 Apr 2010 23:18:16 +0200 Subject: [PATCH] * commands/i386/pc/play.c (grub_cmd_play): Call 'grub_file_open' only if argc is 1. --- ChangeLog | 2 ++ commands/i386/pc/play.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c06df52d5..4c8f2b2f8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2010-04-28 Samuel Thibault * 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 diff --git a/commands/i386/pc/play.c b/commands/i386/pc/play.c index 44d98a1f0..4ed937d4a 100644 --- a/commands/i386/pc/play.c +++ b/commands/i386/pc/play.c @@ -177,16 +177,20 @@ static grub_err_t grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), int argc, char **args) { - grub_file_t file; if (argc < 1) return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name or tempo and notes required"); - file = grub_file_open (args[0]); - if (file) + if (argc == 1) { struct note buf; 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)) {