aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libsandbox/wrapper-funcs/__openat_2.c')
-rw-r--r--libsandbox/wrapper-funcs/__openat_2.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libsandbox/wrapper-funcs/__openat_2.c b/libsandbox/wrapper-funcs/__openat_2.c
index 3384b93..fd13714 100644
--- a/libsandbox/wrapper-funcs/__openat_2.c
+++ b/libsandbox/wrapper-funcs/__openat_2.c
@@ -21,20 +21,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;