Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions backend/src/osx_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
10 changes: 6 additions & 4 deletions backend/src/unix_platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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));

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion backend/src/windows_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "pcap.h"
using namespace std;

WindowsPlatform::WindowsPlatform(vector<string>)
WindowsPlatform::WindowsPlatform(string)
{
// FIXME
}
Expand Down
2 changes: 1 addition & 1 deletion backend/src/windows_platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ using namespace std;
class WindowsPlatform : public AbstractPlatform
{
public:
WindowsPlatform(vector<string>);
WindowsPlatform(string);
bool is_root();
bool check_permissions();
void fix_permissions();
Expand Down