summaryrefslogtreecommitdiff
path: root/storeio
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1999-05-01 06:05:22 +0000
committerRoland McGrath <roland@gnu.org>1999-05-01 06:05:22 +0000
commit834580b49008057cf4f1ab54595b86b6499a79e0 (patch)
tree832a5bfd0d18b887bb0ac85d11df86f27901d022 /storeio
parentc09179c4e150d8588d617d3aea91debc146e1ea1 (diff)
1999-04-30 Mark Kettenis <kettenis@gnu.org>
* storeio.c (trivfs_modify_stat): Do not assume that we have the device open in the caculation of st_mode. If the device is not open, only return S_IFCHR if inhibit_cache is set.
Diffstat (limited to 'storeio')
-rw-r--r--storeio/storeio.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/storeio/storeio.c b/storeio/storeio.c
index 600fbb57..afd654bb 100644
--- a/storeio/storeio.c
+++ b/storeio/storeio.c
@@ -230,6 +230,8 @@ trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
{
struct open *open = cred->po->hook;
+ st->st_mode &= ~S_IFMT;
+
if (open)
/* An open device. */
{
@@ -241,6 +243,9 @@ trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
st->st_size = size;
st->st_blocks = size / 512;
+
+ st->st_mode |= ((inhibit_cache || store->block_size == 1)
+ ? S_IFCHR : S_IFBLK);
}
else
/* Try and do things without an open device... */
@@ -248,12 +253,10 @@ trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st)
st->st_blksize = 0;
st->st_size = 0;
st->st_blocks = 0;
+
+ st->st_mode |= inhibit_cache ? S_IFCHR : S_IFBLK;
}
- st->st_mode &= ~S_IFMT;
- st->st_mode |= ((open->dev->inhibit_cache
- || open->dev->store->block_size == 1)
- ? S_IFCHR : S_IFBLK);
st->st_rdev = rdev;
if (readonly)
st->st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);