diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-05-20 14:55:29 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-05-20 18:14:01 +0200 |
commit | 9ec31e57278ffc4e680ef03e75ce5b6b02e5edcf (patch) | |
tree | 458e020a274453bacf526e444594138ca67c36ef /sysdeps/mach/hurd/readdir.c | |
parent | 36cc908ed549389713955093bbfeaa35fdaf3e2e (diff) | |
download | glibc-9ec31e57278ffc4e680ef03e75ce5b6b02e5edcf.tar glibc-9ec31e57278ffc4e680ef03e75ce5b6b02e5edcf.tar.gz glibc-9ec31e57278ffc4e680ef03e75ce5b6b02e5edcf.tar.bz2 glibc-9ec31e57278ffc4e680ef03e75ce5b6b02e5edcf.zip |
hurd: Use __hurd_fail () instead of assigning errno
The __hurd_fail () inline function is the dedicated, idiomatic way of
reporting errors in the Hurd part of glibc. Not only is it more concise
than '{ errno = err; return -1; }', it is since commit
6639cc10029e24e06b34e169712b21c31b8cf213
"hurd: Mark error functions as __COLD" marked with the cold attribute,
telling the compiler that this codepath is unlikely to be executed.
In one case, use __hurd_dfail () over the plain __hurd_fail ().
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230520115531.3911877-1-bugaevc@gmail.com>
Diffstat (limited to 'sysdeps/mach/hurd/readdir.c')
-rw-r--r-- | sysdeps/mach/hurd/readdir.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/sysdeps/mach/hurd/readdir.c b/sysdeps/mach/hurd/readdir.c index d52cfe7df0..bf67823e47 100644 --- a/sysdeps/mach/hurd/readdir.c +++ b/sysdeps/mach/hurd/readdir.c @@ -21,6 +21,7 @@ #include <unistd.h> #include <endian.h> #include <assert.h> +#include <hurd.h> /* Read a directory entry from DIRP. */ struct dirent * @@ -52,10 +53,7 @@ __readdir (DIR *dirp) - sizeof entry->d_ino); const ino_t d_ino = entry64->d_ino; if (d_ino != entry64->d_ino) - { - __set_errno (EOVERFLOW); - return NULL; - } + return __hurd_fail (EOVERFLOW), NULL; # if BYTE_ORDER != BIG_ENDIAN /* We just skipped over the zero high word. */ entry->d_ino = d_ino; /* ... or the nonzero low word, swap it. */ # endif |