util: replaced ENODATA with ENOATTR for non-Linux systems
On Linux ENODATA is defined but on BSD, and MacOSX ENOATTR is used instead. Defined ENODATA to be ENOATTR when the system is not Linux. v2: Replaced ENODATA and ENOATTR with -EFAULT that is exists everywhere and added a comment (Ian Romanick) Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11203>
This commit is contained in:
parent
d8bbb9daa2
commit
32b94df23e
|
@ -89,7 +89,12 @@ typedef ptrdiff_t ssize_t;
|
|||
static ssize_t
|
||||
readN(int fd, char *buf, size_t len)
|
||||
{
|
||||
int err = -ENODATA;
|
||||
/* err was initially set to -ENODATA but in some BSD systems
|
||||
* ENODATA is not defined and ENOATTR is used instead.
|
||||
* As err is not returned by any function it can be initialized
|
||||
* to -EFAULT that exists everywhere.
|
||||
*/
|
||||
int err = -EFAULT;
|
||||
size_t total = 0;
|
||||
do {
|
||||
ssize_t ret = read(fd, buf + total, len - total);
|
||||
|
|
Loading…
Reference in New Issue