summaryrefslogtreecommitdiff
path: root/libstore
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1997-02-20 02:28:06 +0000
committerMiles Bader <miles@gnu.org>1997-02-20 02:28:06 +0000
commitf265a76cb4d51974fc185d43053f691c0b2b0d07 (patch)
tree0d84a282423333a01387f32525a3a9f00e020c73 /libstore
parent83173056581256944fa4f7ac1105f4fdf523326f (diff)
(dev_set_flags):
Correctly check for unenforcable runs.
Diffstat (limited to 'libstore')
-rw-r--r--libstore/device.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libstore/device.c b/libstore/device.c
index 4c50d777..7ae66ed0 100644
--- a/libstore/device.c
+++ b/libstore/device.c
@@ -1,6 +1,6 @@
/* Mach device store backend
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -135,19 +135,28 @@ static error_t
dev_set_flags (struct store *store, int flags)
{
if ((flags & ~(STORE_INACTIVE | STORE_ENFORCED)) != 0)
+ /* Trying to set flags we don't support. */
return EINVAL;
+
if (! ((store->flags | flags) & STORE_INACTIVE))
- if (store->num_runs >= 0 || store->runs[0].start != 0)
+ /* Currently active and staying that way, so we must be trying to set the
+ STORE_ENFORCED flag. */
+ if (store->num_runs > 0 || store->runs[0].start != 0)
+ /* Can't enforce non-contiguous ranges, or one not starting at 0. */
return EINVAL;
- else if (flags & STORE_ENFORCED)
+ else
+ /* See if the the current (one) range is that the kernel is enforcing. */
{
error_t err = enforced (store);
if (err)
return err;
}
+
if (flags & STORE_INACTIVE)
dclose (store);
+
store->flags |= flags; /* When inactive, anything goes. */
+
return 0;
}