diff options
author | Thomas Bushnell <thomas@gnu.org> | 1996-08-12 18:31:04 +0000 |
---|---|---|
committer | Thomas Bushnell <thomas@gnu.org> | 1996-08-12 18:31:04 +0000 |
commit | 9474c6318ad2effa3e80246d1012cb111e726bf0 (patch) | |
tree | b1f5dbfbd38913dcc4ebf721f81443472937dec0 /libdiskfs/dev-io.c | |
parent | 4b4fc640461f0f6e152204deda38a4e9272fe9e1 (diff) |
*** empty log message ***
Diffstat (limited to 'libdiskfs/dev-io.c')
-rw-r--r-- | libdiskfs/dev-io.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libdiskfs/dev-io.c b/libdiskfs/dev-io.c index 9d0ed9d0..d3be449f 100644 --- a/libdiskfs/dev-io.c +++ b/libdiskfs/dev-io.c @@ -1,5 +1,5 @@ /* Device input and output - Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. + Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -29,10 +29,15 @@ error_t diskfs_device_write_sync (off_t addr, vm_address_t data, size_t len) { int written; + error_t err; + assert (!diskfs_readonly); - if (device_write (diskfs_device, 0, diskfs_device_start + addr, - (io_buf_ptr_t) data, len, &written) - || written != len) + err = device_write (diskfs_device, 0, diskfs_device_start + addr, + (io_buf_ptr_t) data, len, &written); + + if (err == D_READ_ONLY) + return EROFS; + else if (err || written != len) return EIO; return 0; } |