From 62a981a84e2f556059faf13487d9ccc2a3535aa9 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 1 Jun 2016 12:50:46 +0100 Subject: [PATCH] Fix Linux compile errors. --- YSFReflector/YSFReflector.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/YSFReflector/YSFReflector.cpp b/YSFReflector/YSFReflector.cpp index 7b8d069..253c239 100644 --- a/YSFReflector/YSFReflector.cpp +++ b/YSFReflector/YSFReflector.cpp @@ -26,6 +26,11 @@ #include #else #include +#include +#include +#include +#include +#include #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; } } }