projects
/
manu
/
suphp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
0.6.1-1 release
[manu/suphp.git]
/
src
/
API_Linux.cpp
diff --git
a/src/API_Linux.cpp
b/src/API_Linux.cpp
index
45e8519
..
2b3ea45
100644
(file)
--- a/
src/API_Linux.cpp
+++ b/
src/API_Linux.cpp
@@
-237,7
+237,7
@@
std::string suPHP::API_Linux::File_getRealPath(const File& file) const
std::string resolvedpath = "";
bool failed = true;
std::string resolvedpath = "";
bool failed = true;
- if (
currentpath.at(0) != '/'
) {
+ if (
(currentpath.size() == 0) || (currentpath.at(0) != '/')
) {
currentpath = this->getCwd() + std::string("/") + currentpath;
}
currentpath = this->getCwd() + std::string("/") + currentpath;
}
@@
-452,3
+452,11
@@
void suPHP::API_Linux::setCwd(const std::string& dir) const
void suPHP::API_Linux::setUmask(int mode) const throw (SystemException) {
::umask(mode);
}
void suPHP::API_Linux::setUmask(int mode) const throw (SystemException) {
::umask(mode);
}
+
+void suPHP::API_Linux::chroot(const std::string& dir) const
+ throw (SystemException) {
+ if (::chroot(dir.c_str())) {
+ throw SystemException(std::string("chroot() failed: ")
+ + ::strerror(errno), __FILE__, __LINE__);
+ }
+}