Fix Linux compile errors.
This commit is contained in:
parent
0dcdd4778a
commit
62a981a84e
1 changed files with 12 additions and 7 deletions
|
@ -26,6 +26,11 @@
|
|||
#include <Windows.h>
|
||||
#else
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
@ -98,7 +103,7 @@ void CYSFReflector::run()
|
|||
pid_t pid = ::fork();
|
||||
if (pid == -1) {
|
||||
::LogWarning("Couldn't fork() , exiting");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
else if (pid != 0)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
@ -106,13 +111,13 @@ void CYSFReflector::run()
|
|||
// Create new session and process group
|
||||
if (::setsid() == -1) {
|
||||
::LogWarning("Couldn't setsid(), exiting");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the working directory to the root directory
|
||||
if (::chdir("/") == -1) {
|
||||
::LogWarning("Couldn't cd /, exiting");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
::close(STDIN_FILENO);
|
||||
|
@ -124,7 +129,7 @@ void CYSFReflector::run()
|
|||
struct passwd* user = ::getpwnam("mmdvm");
|
||||
if (user == NULL) {
|
||||
::LogError("Could not get the mmdvm user, exiting");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
uid_t mmdvm_uid = user->pw_uid;
|
||||
|
@ -133,18 +138,18 @@ void CYSFReflector::run()
|
|||
//Set user and group ID's to mmdvm:mmdvm
|
||||
if (setgid(mmdvm_gid) != 0) {
|
||||
::LogWarning("Could not set mmdvm GID, exiting");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (setuid(mmdvm_uid) != 0) {
|
||||
::LogWarning("Could not set mmdvm UID, exiting");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
|
||||
//Double check it worked (AKA Paranoia)
|
||||
if (setuid(0) != -1) {
|
||||
::LogWarning("It's possible to regain root - something is wrong!, exiting");
|
||||
return -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue