diff options
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/mach/hurd/not-cancel.h | 12 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/not-cancel.h | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h index ae58b734e3..e2edfb1cf3 100644 --- a/sysdeps/mach/hurd/not-cancel.h +++ b/sysdeps/mach/hurd/not-cancel.h @@ -25,6 +25,7 @@ #include <sys/wait.h> #include <time.h> #include <sys/uio.h> +#include <sys/random.h> #include <hurd.h> #include <hurd/fd.h> @@ -75,8 +76,15 @@ __typeof (__fcntl) __fcntl_nocancel; #define __fcntl64_nocancel(...) \ __fcntl_nocancel (__VA_ARGS__) -#define __getrandom_nocancel(buf, size, flags) \ - __getrandom (buf, size, flags) +static inline ssize_t +__getrandom_nocancel (void *buf, size_t buflen, unsigned int flags) +{ + int save_errno = errno; + ssize_t r = __getrandom (buf, buflen, flags); + r = r == -1 ? -errno : r; + __set_errno (save_errno); + return r; +} #define __poll_infinity_nocancel(fds, nfds) \ __poll (fds, nfds, -1) diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index cf35c8bfc9..93615de681 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -71,7 +71,7 @@ __writev_nocancel_nostatus (int fd, const struct iovec *iov, int iovcnt) static inline ssize_t __getrandom_nocancel (void *buf, size_t buflen, unsigned int flags) { - return INLINE_SYSCALL_CALL (getrandom, buf, buflen, flags); + return INTERNAL_SYSCALL_CALL (getrandom, buf, buflen, flags); } static inline int |