Generate a read error
testing, unix
Solution
Besides reading from a directory (as mentioned in a previous answer) you can try to read `/proc/self/mem` to get an error (this should get you an `EIO` on Linux). For an explanation, please see: https://unix.stackexchange.com/a/6302
Problem
It's simple to generate a write error in a test suite by writing to `/dev/full`. Is there a good technique to generate a read error? I'm currently using LD_PRELOAD to override `read` but that seems too complicated and non-portable (not that /dev/full is portable...).