summaryrefslogtreecommitdiff
path: root/libdiskfs/readonly.c
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1996-08-12 18:31:04 +0000
committerThomas Bushnell <thomas@gnu.org>1996-08-12 18:31:04 +0000
commit9474c6318ad2effa3e80246d1012cb111e726bf0 (patch)
treeb1f5dbfbd38913dcc4ebf721f81443472937dec0 /libdiskfs/readonly.c
parent4b4fc640461f0f6e152204deda38a4e9272fe9e1 (diff)
*** empty log message ***
Diffstat (limited to 'libdiskfs/readonly.c')
-rw-r--r--libdiskfs/readonly.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libdiskfs/readonly.c b/libdiskfs/readonly.c
index 18ade09a..17ed312e 100644
--- a/libdiskfs/readonly.c
+++ b/libdiskfs/readonly.c
@@ -21,6 +21,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <fcntl.h>
+#include <error.h>
#include "priv.h"
@@ -29,13 +30,23 @@ int _diskfs_diskdirty;
int
diskfs_check_readonly ()
{
+ error_t err;
+
if (diskfs_readonly)
return 1;
else
{
if (!_diskfs_diskdirty)
{
- diskfs_set_hypermetadata (1, 0);
+ err = diskfs_set_hypermetadata (1, 0);
+ if (err)
+ {
+ error (0, 0,
+ "%s: MEDIA NOT WRITABLE; switching to READ-ONLY",
+ diskfs_device_arg);
+ diskfs_readonly = 1;
+ return 1;
+ }
_diskfs_diskdirty = 1;
}
return 0;