projects
/
manu
/
suphp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r9183@datura: manu | 2008-06-04 09:59:07 +0200
[manu/suphp.git]
/
src
/
API_Linux.cpp
diff --git
a/src/API_Linux.cpp
b/src/API_Linux.cpp
index
45e8519
..
97c1e90
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;
}
@@
-336,7
+336,7
@@
bool suPHP::API_Linux::File_hasPermissionBit(const File& file, FileMode perm)
break;
case FILEMODE_GROUP_EXEC:
break;
case FILEMODE_GROUP_EXEC:
- if ((temp.st_mode & S_I
WGRP) == S_IW
GRP)
+ if ((temp.st_mode & S_I
XGRP) == S_IX
GRP)
return true;
break;
return true;
break;
@@
-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__);
+ }
+}