aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2006-07-13 12:26:42 +0000
committerMartin Schlemmer <azarah@gentoo.org>2006-07-13 12:26:42 +0000
commit783f38f28e4ccc08caff3b54df3f4e1ac791ce1b (patch)
treec5bc93bec4895f8c03ae0dd2f47c386c42e47afe /libsandbox/wrapper-funcs/unlink.c
parentCleanup execve() wrapper. (diff)
downloadsandbox-783f38f28e4ccc08caff3b54df3f4e1ac791ce1b.tar.gz
sandbox-783f38f28e4ccc08caff3b54df3f4e1ac791ce1b.tar.bz2
sandbox-783f38f28e4ccc08caff3b54df3f4e1ac791ce1b.zip
Make sure the unlink() wrapper do not touch errno.
Signed-off-by: Martin Schlemmer <azarah@gentoo.org>
Diffstat (limited to 'libsandbox/wrapper-funcs/unlink.c')
-rw-r--r--libsandbox/wrapper-funcs/unlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libsandbox/wrapper-funcs/unlink.c b/libsandbox/wrapper-funcs/unlink.c
index 8bcd47c..75e341f 100644
--- a/libsandbox/wrapper-funcs/unlink.c
+++ b/libsandbox/wrapper-funcs/unlink.c
@@ -31,7 +31,7 @@ static int (*WRAPPER_TRUE_NAME) (const char *) = NULL;
int WRAPPER_NAME(const char *pathname)
{
- int result = -1;
+ int result = -1, old_errno = errno;
char canonic[SB_PATH_MAX];
if (-1 == canonicalize(pathname, canonic))
@@ -47,6 +47,7 @@ int WRAPPER_NAME(const char *pathname)
errno = EACCES;
return result;
}
+ errno = old_errno;
if FUNCTION_SANDBOX_SAFE("unlink", pathname) {
check_dlsym(WRAPPER_TRUE_NAME, WRAPPER_SYMNAME,