aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libsandbox/wrapper-funcs/openat.c')
-rw-r--r--libsandbox/wrapper-funcs/openat.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libsandbox/wrapper-funcs/openat.c b/libsandbox/wrapper-funcs/openat.c
index 9468515..2855464 100644
--- a/libsandbox/wrapper-funcs/openat.c
+++ b/libsandbox/wrapper-funcs/openat.c
@@ -25,20 +25,20 @@
static inline bool PRE_CHECK_FUNC(WRAPPER_NAME)(_WRAPPER_ARGS_PROTO)
{
if (!(flags & O_CREAT)) {
- save_errno();
-
/* If we're not trying to create, fail normally if
* file does not stat
*/
- struct stat st;
#if USE_AT
if (dirfd == AT_FDCWD || pathname[0] == '/')
#endif
#undef USE_AT
+ {
+ struct stat st;
+ save_errno();
if (-1 == stat(pathname, &st))
return false;
-
- restore_errno();
+ restore_errno();
+ }
}
return true;