aboutsummaryrefslogtreecommitdiffstats
path: root/src/libunixonacid/open2_at.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libunixonacid/open2_at.c')
-rw-r--r--src/libunixonacid/open2_at.c2
1 files changed, 2 insertions, 0 deletions
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 ;
}