* 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.
* grub-core/fs/btrfs.c: Likewise.
* grub-core/commands/i386/pc/play.c: Likewise.
+2011-06-26 Yves Blusseau <blusseau@zetam.org>
+
+ 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.
+ * grub-core/fs/btrfs.c: Likewise.
+ * grub-core/commands/i386/pc/play.c: Likewise.
+
2011-06-26 Szymon Janc <szymon@janc.net.pl>
* grub-core/commands/cmp.c (grub_cmd_cmp): Remove unnecessary NULL
file = grub_file_open (args[0]);
if (! file)
- return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
+ return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", args[0]);
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
{
if (*end)
/* Was not a number either, assume it was supposed to be a file name. */
- return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
+ return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", args[0]);
grub_dprintf ("play","tempo = %d\n", tempo);
const char *ctoken;
grub_size_t ctokenlen;
char *path_alloc = NULL;
+ char *origpath = NULL;
unsigned symlinks_max = 32;
*type = GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY;
key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM;
key->offset = 0;
skip_default = 1;
+ origpath = grub_strdup (path);
+ if (!origpath)
+ return grub_errno;
while (1)
{
if (*type != GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
{
grub_free (path_alloc);
+ grub_free (origpath);
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
}
{
grub_free (direl);
grub_free (path_alloc);
+ grub_free (origpath);
return err;
}
if (key_cmp (key, &key_out) != 0)
{
grub_free (direl);
grub_free (path_alloc);
- return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
+ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+ grub_free (origpath);
+ return err;
}
struct grub_btrfs_dir_item *cdirel;
if (!direl)
{
grub_free (path_alloc);
+ grub_free (origpath);
return grub_errno;
}
}
{
grub_free (direl);
grub_free (path_alloc);
+ grub_free (origpath);
return err;
}
{
grub_free (direl);
grub_free (path_alloc);
- return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
+ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+ grub_free (origpath);
+ return err;
}
if (!skip_default)
{
grub_free (direl);
grub_free (path_alloc);
+ grub_free (origpath);
return grub_error (GRUB_ERR_SYMLINK_LOOP,
"too deep nesting of symlinks");
}
{
grub_free (direl);
grub_free (path_alloc);
+ grub_free (origpath);
return err;
}
tmp = grub_malloc (grub_le_to_cpu64 (inode.size)
{
grub_free (direl);
grub_free (path_alloc);
+ grub_free (origpath);
return grub_errno;
}
{
grub_free (direl);
grub_free (path_alloc);
+ grub_free (origpath);
grub_free (tmp);
return grub_errno;
}
grub_memcpy (tmp + grub_le_to_cpu64 (inode.size), path,
grub_strlen (path) + 1);
grub_free (path_alloc);
+ grub_free (origpath);
path = path_alloc = tmp;
if (path[0] == '/')
{
{
grub_free (direl);
grub_free (path_alloc);
+ grub_free (origpath);
return err;
}
if (cdirel->key.object_id != key_out.object_id
{
grub_free (direl);
grub_free (path_alloc);
- return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
+ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+ grub_free (origpath);
+ return err;
}
err = grub_btrfs_read_logical (data, elemaddr,
&ri, sizeof (ri));
{
grub_free (direl);
grub_free (path_alloc);
+ grub_free (origpath);
return err;
}
key->type = GRUB_BTRFS_ITEM_TYPE_DIR_ITEM;
{
grub_free (direl);
grub_free (path_alloc);
- return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
+ err = grub_error (GRUB_ERR_FILE_NOT_FOUND, "file `%s' not found", origpath);
+ grub_free (origpath);
+ return err;
}
*key = cdirel->key;
if (*type == GRUB_BTRFS_DIR_ITEM_TYPE_DIRECTORY)
break;
default:
grub_free (path_alloc);
+ grub_free (origpath);
grub_free (direl);
return grub_error (GRUB_ERR_BAD_FS, "unrecognised object type 0x%x",
cdirel->key.type);
const struct grub_dirhook_info *info))
{
char *dirname, *dirp;
+ char *origpath = NULL;
int call_hook;
int found = 0;
return 0;
}
+ origpath = grub_strdup (path);
+ if (!origpath)
+ return 0;
+
/* Extract a directory name. */
while (*path == '/')
path++;
dirname = grub_malloc (len + 1);
if (! dirname)
- return 0;
+ goto fail;
grub_memcpy (dirname, path, len);
dirname[len] = '\0';
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;
}
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] != '/')
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;
}
}
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;
}
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;
}
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;
}