summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);