diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-26 00:46:27 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-11-26 00:46:27 +0100 |
commit | 2adb43e792bbd8d2cccf0773672f25bd5f4a0613 (patch) | |
tree | 63b3797e576bc9ecbff36341f0f1f8f23e74e909 /storeio | |
parent | 02bec9a7652b981ee00c5656e9235ee0cc897f99 (diff) | |
download | hurd-2adb43e792bbd8d2cccf0773672f25bd5f4a0613.tar.gz hurd-2adb43e792bbd8d2cccf0773672f25bd5f4a0613.tar.bz2 hurd-2adb43e792bbd8d2cccf0773672f25bd5f4a0613.zip |
storeio: Translate short reads to EIO
* storeio/dev.c (dev_buf_fill): When store returns less bytes than the
block size, assume an EIO.
Diffstat (limited to 'storeio')
-rw-r--r-- | storeio/dev.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/storeio/dev.c b/storeio/dev.c index 8bdfa111..c229f37b 100644 --- a/storeio/dev.c +++ b/storeio/dev.c @@ -87,6 +87,14 @@ dev_buf_fill (struct dev *dev, off_t offs) if (err) return err; + if (buf_len < store->block_size) + { + /* Short read, translate this to EIO */ + if (buf != dev->buf) + munmap (buf, buf_len); + return EIO; + } + if (buf != dev->buf) { munmap (dev->buf, store->block_size); |