Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1OzTTl-0000bj-01 for mharc-grub-devel@gnu.org; Sat, 25 Sep 2010 08:03:45 -0400 Received: from [140.186.70.92] (port=59247 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OzTTg-0000a6-VG for grub-devel@gnu.org; Sat, 25 Sep 2010 08:03:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OzTTf-0002qG-Gh for grub-devel@gnu.org; Sat, 25 Sep 2010 08:03:40 -0400 Received: from smtp4-g21.free.fr ([212.27.42.4]:39275) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzTTe-0002po-Qs for grub-devel@gnu.org; Sat, 25 Sep 2010 08:03:39 -0400 Received: from yves.private.network (unknown [88.175.100.234]) by smtp4-g21.free.fr (Postfix) with ESMTP id DBE334C8119 for ; Sat, 25 Sep 2010 14:03:31 +0200 (CEST) Received: from yves.private.network (localhost [127.0.0.1]) by yves.private.network (Postfix) with ESMTP id 9F40197BC54 for ; Sat, 25 Sep 2010 14:03:30 +0200 (CEST) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=MIMEBOUNDARY To: grub-devel@gnu.org From: Yves Blusseau Date: Sat, 25 Sep 2010 14:03:30 +0200 Message-ID: <20100925120330.10878.25689.stgit@yves.private.network> User-Agent: StGit/0.15-97-g9680 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH] Display the path of the file when file is not found X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Sep 2010 12:03:42 -0000 This is a MIME message. --MIMEBOUNDARY Content-Disposition: inline MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit * grub-core/fs/fat.c: Display the filename when file is not found. * grub-core/fs/fshelp.c: Likewise. * grub-core/fs/hfs.c: Likewise. * grub-core/fs/jfs.c: Likewise. * grub-core/fs/minix.c: Likewise. * grub-core/fs/ufs.c: Likewise. --- ChangeLog.filename-file-not-found | 8 ++++++++ grub-core/fs/fat.c | 11 +++++++++-- grub-core/fs/fshelp.c | 2 +- grub-core/fs/hfs.c | 2 +- grub-core/fs/jfs.c | 2 +- grub-core/fs/minix.c | 2 +- grub-core/fs/ufs.c | 2 +- 7 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 ChangeLog.filename-file-not-found --MIMEBOUNDARY Content-Disposition: attachment; filename=filename-not-found.patch MIME-Version: 1.0 Content-Type: text/plain; name=filename-not-found.patch; charset="utf-8" Content-Transfer-Encoding: 7bit diff --git a/ChangeLog.filename-file-not-found b/ChangeLog.filename-file-not-found new file mode 100644 index 0000000..f735f52 --- /dev/null +++ b/ChangeLog.filename-file-not-found @@ -0,0 +1,8 @@ + Display the path of the file when file is not found + + * grub-core/fs/fat.c: Display the filename when file is not found. + * grub-core/fs/fshelp.c: Likewise. + * grub-core/fs/hfs.c: Likewise. + * grub-core/fs/jfs.c: Likewise. + * grub-core/fs/minix.c: Likewise. + * grub-core/fs/ufs.c: Likewise. diff --git a/grub-core/fs/fat.c b/grub-core/fs/fat.c index 8905094..04859da 100644 --- a/grub-core/fs/fat.c +++ b/grub-core/fs/fat.c @@ -608,6 +608,7 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, const struct grub_dirhook_info *info)) { char *dirname, *dirp; + char *origpath = NULL; int call_hook; int found = 0; @@ -648,6 +649,10 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, return 0; } + origpath = grub_strdup (path); + if (!origpath) + return 0; + /* Extract a directory name. */ while (*path == '/') path++; @@ -659,7 +664,7 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, dirname = grub_malloc (len + 1); if (! dirname) - return 0; + goto fail; grub_memcpy (dirname, path, len); dirname[len] = '\0'; @@ -672,9 +677,11 @@ grub_fat_find_dir (grub_disk_t disk, struct grub_fat_data *data, grub_fat_iterate_dir (disk, data, iter_hook); if (grub_errno == GRUB_ERR_NONE && ! found && !call_hook) - grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); + grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath); + fail: grub_free (dirname); + grub_free (origpath); return found ? dirp : 0; } diff --git a/grub-core/fs/fshelp.c b/grub-core/fs/fshelp.c index d0b1e49..177b2a8 100644 --- a/grub-core/fs/fshelp.c +++ b/grub-core/fs/fshelp.c @@ -195,7 +195,7 @@ grub_fshelp_find_file (const char *path, grub_fshelp_node_t rootnode, name = next; } - return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); + return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path); } if (!path || path[0] != '/') diff --git a/grub-core/fs/hfs.c b/grub-core/fs/hfs.c index cef8563..706d0ae 100644 --- a/grub-core/fs/hfs.c +++ b/grub-core/fs/hfs.c @@ -915,7 +915,7 @@ grub_hfs_find_dir (struct grub_hfs_data *data, const char *path, if (! grub_hfs_find_node (data, (char *) &key, data->cat_root, 0, (char *) &fdrec.frec, sizeof (fdrec.frec))) { - grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); + grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath); goto fail; } diff --git a/grub-core/fs/jfs.c b/grub-core/fs/jfs.c index c9839a2..5447f79 100644 --- a/grub-core/fs/jfs.c +++ b/grub-core/fs/jfs.c @@ -684,7 +684,7 @@ grub_jfs_find_file (struct grub_jfs_data *data, const char *path) } grub_jfs_closedir (diro); - grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); + grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path); return grub_errno; } diff --git a/grub-core/fs/minix.c b/grub-core/fs/minix.c index aa5b9a0..fd4c290 100644 --- a/grub-core/fs/minix.c +++ b/grub-core/fs/minix.c @@ -387,7 +387,7 @@ grub_minix_find_file (struct grub_minix_data *data, const char *path) pos += sizeof (ino) + data->filename_size; } while (pos < GRUB_MINIX_INODE_SIZE (data)); - grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); + grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path); return grub_errno; } diff --git a/grub-core/fs/ufs.c b/grub-core/fs/ufs.c index 40cf068..5dd01ab 100644 --- a/grub-core/fs/ufs.c +++ b/grub-core/fs/ufs.c @@ -512,7 +512,7 @@ grub_ufs_find_file (struct grub_ufs_data *data, const char *path) pos += grub_le_to_cpu16 (dirent.direntlen); } while (pos < INODE_SIZE (data)); - grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found"); + grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", path); return grub_errno; } --MIMEBOUNDARY--