Summary: | sandbox problems with mkdir | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Caleb Tennis (RETIRED) <caleb> |
Component: | Unclassified | Assignee: | Martin Schlemmer (RETIRED) <azarah> |
Status: | RESOLVED TEST-REQUEST | ||
Severity: | normal | CC: | carpaski |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Caleb Tennis (RETIRED)
2003-09-27 07:52:59 UTC
Fixed in CVS. Nick please have a look. --------------------------------- Index: ChangeLog =================================================================== RCS file: /home/cvsroot/gentoo-src/portage/src/sandbox-1.1/ChangeLog,v retrieving revision 1.20 diff -u -p -r1.20 ChangeLog --- ChangeLog 27 Jul 2003 15:05:49 -0000 1.20 +++ ChangeLog 27 Sep 2003 16:41:58 -0000 @@ -2,6 +2,10 @@ # Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2 # $Header: /home/cvsroot/gentoo-src/portage/src/sandbox-1.1/ChangeLog,v 1.20 2003/07/27 15:05:49 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 = "". Index: libsandbox.c =================================================================== RCS file: /home/cvsroot/gentoo-src/portage/src/sandbox-1.1/libsandbox.c,v retrieving revision 1.9 diff -u -p -r1.9 libsandbox.c --- libsandbox.c 27 Jul 2003 15:05:49 -0000 1.9 +++ libsandbox.c 27 Sep 2003 16:41:58 -0000 @@ -460,11 +460,20 @@ link(const char *oldpath, const char *ne 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); |