aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libsandbox/wrapper-funcs')
-rw-r--r--libsandbox/wrapper-funcs/__openat_2.c10
-rw-r--r--libsandbox/wrapper-funcs/openat.c10
2 files changed, 10 insertions, 10 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;
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;