diff --git a/backend/src/main.cpp b/backend/src/main.cpp index 989e88a..b2128d0 100644 --- a/backend/src/main.cpp +++ b/backend/src/main.cpp @@ -63,8 +63,8 @@ int main(int argc, const char *argv[]) string filter(argv[2]); if (argc > 4) { - freopen(string(argv[3]).c_str(), "w", stdout); - freopen(string(argv[4]).c_str(), "w", stderr); + freopen(argv[3], "w", stdout); + freopen(argv[4], "w", stderr); // rw-rw-rw- mode_t mode = S_IFREG | diff --git a/backend/src/osx_platform.cpp b/backend/src/osx_platform.cpp index 2bce65e..5279e2d 100644 --- a/backend/src/osx_platform.cpp +++ b/backend/src/osx_platform.cpp @@ -39,7 +39,7 @@ bool OSXPlatform::run_privileged() OSStatus err; AuthorizationFlags flags; - const char *path = this->path().c_str(); + const string &path = this->path(); flags = kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed; @@ -49,7 +49,7 @@ bool OSXPlatform::run_privileged() char *args[] = { (char *) "--fix-permissions", NULL }; - err = AuthorizationExecuteWithPrivileges(auth, path, kAuthorizationFlagDefaults, args, NULL); + err = AuthorizationExecuteWithPrivileges(auth, path.c_str(), kAuthorizationFlagDefaults, args, NULL); AuthorizationFree(auth, kAuthorizationFlagDefaults); if (err == errAuthorizationCanceled) return false; diff --git a/backend/src/unix_platform.hpp b/backend/src/unix_platform.hpp index e2e060e..817f926 100644 --- a/backend/src/unix_platform.hpp +++ b/backend/src/unix_platform.hpp @@ -61,7 +61,9 @@ class UnixPlatform : public AbstractPlatform int err; struct stat file_stat; - err = stat(this->path().c_str(), &file_stat); + const string &path = this->path(); + + err = stat(path.c_str(), &file_stat); if (err == -1) throw runtime_error("stat() failed"); @@ -75,10 +77,10 @@ class UnixPlatform : public AbstractPlatform int err; int fd; - const char *path = this->path().c_str(); + const string &path = this->path(); // Open the file. - fd = open(path, O_RDONLY, 0); + fd = open(path.c_str(), O_RDONLY, 0); if (fd < 0) throw runtime_error(str(boost::format("fix_permissions: open() failed: %d.") % errno)); @@ -109,7 +111,7 @@ class UnixPlatform : public AbstractPlatform char path[PATH_MAX]; if (!realpath(m_path.c_str(), path)) throw runtime_error(str(boost::format("realpath() failed: %d\n") % errno)); - return m_path; + return string(path); } private: diff --git a/backend/src/windows_platform.cpp b/backend/src/windows_platform.cpp index ba6e97e..37260a7 100644 --- a/backend/src/windows_platform.cpp +++ b/backend/src/windows_platform.cpp @@ -27,7 +27,7 @@ #include "pcap.h" using namespace std; -WindowsPlatform::WindowsPlatform(vector) +WindowsPlatform::WindowsPlatform(string) { // FIXME } diff --git a/backend/src/windows_platform.hpp b/backend/src/windows_platform.hpp index 8fda1b8..bbf2b57 100644 --- a/backend/src/windows_platform.hpp +++ b/backend/src/windows_platform.hpp @@ -34,7 +34,7 @@ using namespace std; class WindowsPlatform : public AbstractPlatform { public: - WindowsPlatform(vector); + WindowsPlatform(string); bool is_root(); bool check_permissions(); void fix_permissions();