* util/grub-mount.c: Handle symlinks to directories.
This commit is contained in:
parent
1397f0b520
commit
4685200fa9
2 changed files with 31 additions and 9 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2013-11-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-mount.c: Handle symlinks to directories.
|
||||||
|
|
||||||
2013-11-02 Vladimir Serbinenko <phcoder@gmail.com>
|
2013-11-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/fs/fshelp.c (find_file): Save ctx->next when calling
|
* grub-core/fs/fshelp.c (find_file): Save ctx->next when calling
|
||||||
|
|
|
@ -205,17 +205,24 @@ fuse_getattr (const char *path, struct stat *st)
|
||||||
st->st_uid = 0;
|
st->st_uid = 0;
|
||||||
st->st_gid = 0;
|
st->st_gid = 0;
|
||||||
st->st_rdev = 0;
|
st->st_rdev = 0;
|
||||||
|
st->st_size = 0;
|
||||||
if (!ctx.file_info.dir)
|
if (!ctx.file_info.dir)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
file = grub_file_open (path);
|
file = grub_file_open (path);
|
||||||
if (! file)
|
if (! file && grub_errno == GRUB_ERR_BAD_FILE_TYPE)
|
||||||
|
{
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
st->st_mode = (0555 | S_IFDIR);
|
||||||
|
}
|
||||||
|
else if (! file)
|
||||||
return translate_error ();
|
return translate_error ();
|
||||||
st->st_size = file->size;
|
else
|
||||||
grub_file_close (file);
|
{
|
||||||
|
st->st_size = file->size;
|
||||||
|
grub_file_close (file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
st->st_size = 0;
|
|
||||||
st->st_blksize = 512;
|
st->st_blksize = 512;
|
||||||
st->st_blocks = (st->st_size + 511) >> 9;
|
st->st_blocks = (st->st_size + 511) >> 9;
|
||||||
st->st_atime = st->st_mtime = st->st_ctime = ctx.file_info.mtimeset
|
st->st_atime = st->st_mtime = st->st_ctime = ctx.file_info.mtimeset
|
||||||
|
@ -304,10 +311,21 @@ fuse_readdir_call_fill (const char *filename,
|
||||||
tmp = xasprintf ("%s/%s", ctx->path, filename);
|
tmp = xasprintf ("%s/%s", ctx->path, filename);
|
||||||
file = grub_file_open (tmp);
|
file = grub_file_open (tmp);
|
||||||
free (tmp);
|
free (tmp);
|
||||||
if (! file)
|
/* Symlink to directory. */
|
||||||
return translate_error ();
|
if (! file && grub_errno == GRUB_ERR_BAD_FILE_TYPE)
|
||||||
st.st_size = file->size;
|
{
|
||||||
grub_file_close (file);
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
st.st_mode = (0555 | S_IFDIR);
|
||||||
|
}
|
||||||
|
else if (!file)
|
||||||
|
{
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
st.st_size = file->size;
|
||||||
|
grub_file_close (file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
st.st_blksize = 512;
|
st.st_blksize = 512;
|
||||||
st.st_blocks = (st.st_size + 511) >> 9;
|
st.st_blocks = (st.st_size + 511) >> 9;
|
||||||
|
|
Loading…
Reference in a new issue