aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schlemmer <azarah@gentoo.org>2003-09-27 16:46:43 +0000
committerMartin Schlemmer <azarah@gentoo.org>2003-09-27 16:46:43 +0000
commitdf088fd31e7577c27d2e9ed37bb41c2074cc743d (patch)
tree3ee05a1124752f4d2c5d79ec6782948337b0155b /src
parentfix path #29695 (diff)
downloadportage-cvs-df088fd31e7577c27d2e9ed37bb41c2074cc743d.tar.gz
portage-cvs-df088fd31e7577c27d2e9ed37bb41c2074cc743d.tar.bz2
portage-cvs-df088fd31e7577c27d2e9ed37bb41c2074cc743d.zip
Fix our mkdir wrapper to check if the dir exist, and return EEXIST if so,
rather than failing with a violation, bug #29748.
Diffstat (limited to 'src')
-rw-r--r--src/sandbox-1.1/ChangeLog6
-rw-r--r--src/sandbox-1.1/libsandbox.c17
2 files changed, 18 insertions, 5 deletions
diff --git a/src/sandbox-1.1/ChangeLog b/src/sandbox-1.1/ChangeLog
index 46d5e15..334620f 100644
--- a/src/sandbox-1.1/ChangeLog
+++ b/src/sandbox-1.1/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for Path Sandbox
# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/ChangeLog,v 1.20 2003/07/27 15:05:49 azarah Exp $
+# $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/ChangeLog,v 1.21 2003/09/27 16:46:43 azarah Exp $
+
+ 27 Sep 2003; Martin Schlemmer <azarah@gentoo.org> libsandbox.c :
+ Fix our mkdir wrapper to check if the dir exist, and return EEXIST if so,
+ rather than failing with a violation, bug #29748.
27 Jul 2003; Martin Schlemmer <azarah@gentoo.org> libsandbox.c :
Fix canonicalize() to ignore calls with path = "".
diff --git a/src/sandbox-1.1/libsandbox.c b/src/sandbox-1.1/libsandbox.c
index 5948887..7280e79 100644
--- a/src/sandbox-1.1/libsandbox.c
+++ b/src/sandbox-1.1/libsandbox.c
@@ -25,7 +25,7 @@
* as some of the InstallWatch code was used.
*
*
- * $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/libsandbox.c,v 1.9 2003/07/27 15:05:49 azarah Exp $
+ * $Header: /local/data/ulm/cvs/history/var/cvsroot/gentoo-src/portage/src/sandbox-1.1/Attic/libsandbox.c,v 1.10 2003/09/27 16:46:43 azarah Exp $
*
*/
@@ -460,11 +460,20 @@ link(const char *oldpath, const char *newpath)
int
mkdir(const char *pathname, mode_t mode)
{
- int result = -1;
+ int result = -1, my_errno = errno;
char canonic[SB_PATH_MAX];
+ struct stat st;
canonicalize_int(pathname, canonic);
+ /* Check if the directory exist, return EEXIST rather than failing */
+ lstat(canonic, &st);
+ if (0 == errno) {
+ errno = EEXIST;
+ return errno;
+ }
+ errno = my_errno;
+
if FUNCTION_SANDBOX_SAFE
("mkdir", canonic) {
check_dlsym(mkdir);
@@ -1011,8 +1020,8 @@ check_access(sbcontext_t * sbcontext, const char *func, const char *path)
(0 == strncmp(func, "execlp", 6)) ||
(0 == strncmp(func, "execle", 6)) ||
(0 == strncmp(func, "execv", 5)) ||
- (0 == strncmp(func, "execvp", 6))
- || (0 == strncmp(func, "execve", 6))
+ (0 == strncmp(func, "execvp", 6)) ||
+ (0 == strncmp(func, "execve", 6))
)
) {
for (i = 0; i < sbcontext->num_read_prefixes; i++) {