Mesa (main): util: replaced ENODATA with ENOATTR for non-Linux systems

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 28 18:39:33 UTC 2021


Module: Mesa
Branch: main
Commit: 32b94df23e1a156edfc0759f9c582afabf85b01a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=32b94df23e1a156edfc0759f9c582afabf85b01a

Author: Eleni Maria Stea <elene.mst at gmail.com>
Date:   Mon Jun  7 09:10:30 2021 +0300

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 at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11203>

---

 src/util/os_file.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/util/os_file.c b/src/util/os_file.c
index 1c30df6486a..5f79284e083 100644
--- a/src/util/os_file.c
+++ b/src/util/os_file.c
@@ -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);



More information about the mesa-commit mailing list