diff options
author | 2016-12-24 03:57:47 -0500 | |
---|---|---|
committer | 2017-01-15 01:59:49 -0500 | |
commit | 0cedae398a108e287edb440ddcf877fb58bcb272 (patch) | |
tree | 5b6bc0b48eb25f1626ca0a4a79ffa214917581c9 /README | |
parent | eff9d66ba6af627543a37ea36567d9ce6d0e28a8 (diff) |
Clean up error handling
Make several changes to error handling:
• Check for negative values from sprintf, and treat them as errors.
• Check for errors from fscanf both by comparing its return value against
EOF and by checking ferror.
• Avoiding calling perror with errno set to -1. Either set a meaningful
value, such as EINVAL, or use fprintf if errno cannot be expected to
have a meaningful value.
• Instead of re-using errno for internal error handling, use a new variable
to indicate errors where it makes sense to do so.
• In read_device, print more specific error messages if we fail to read
a device's current or max brightness, and print an error message
immediately if a read fails, instead of only maybe at the end of
read_device.
Diffstat (limited to 'README')
0 files changed, 0 insertions, 0 deletions