diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-03-07 01:44:45 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-03-07 01:44:45 -0500 |
commit | 31e552065c41abbba77cf92717533c5d8f2a98e0 (patch) | |
tree | f9fcf1952ff2e034c4f42fb8952a02651cee28e5 /libsandbox/wrapper-funcs/__openat_2.c | |
parent | add a test case for previous commit (diff) | |
download | sandbox-31e552065c41abbba77cf92717533c5d8f2a98e0.tar.gz sandbox-31e552065c41abbba77cf92717533c5d8f2a98e0.tar.bz2 sandbox-31e552065c41abbba77cf92717533c5d8f2a98e0.zip |
libsandbox: push errno save/restore down in openat()
Minor optimization to not bother saving/restoring the errno if we don't
actually call another C library function.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libsandbox/wrapper-funcs/__openat_2.c')
-rw-r--r-- | libsandbox/wrapper-funcs/__openat_2.c | 10 |
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; |