From e99182dab3093f1645f9e4ff216aa752d7443fb1 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 1 Jan 2026 13:47:45 +0000 Subject: Save/restore errno in all safe wrappers --- src/libunixonacid/open2_at.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/libunixonacid/open2_at.c') diff --git a/src/libunixonacid/open2_at.c b/src/libunixonacid/open2_at.c index 3afc4fb..0b07f0e 100644 --- a/src/libunixonacid/open2_at.c +++ b/src/libunixonacid/open2_at.c @@ -18,9 +18,11 @@ int open2_at (int dirfd, char const *file, int flags) { + int e = errno ; int fd ; do fd = openat(dirfd, file, flags) ; /* all systems supporting openat() have O_CLOEXEC */ while (fd == -1 && errno == EINTR) ; + if (fd >= 0) errno = e ; return fd ; } -- cgit v1.3.1