Refactored defines and core includes, added root permissions check on InputDeviceServices and fixed the weird one character space in the log that occurs after the requires.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* InputDeviceServices.API.php
|
||||
*
|
||||
* Provides Input Device Mirroring for Devices, entirely in Userspace.
|
||||
* @package default
|
||||
*/
|
||||
|
||||
@@ -28,7 +28,9 @@ class InputDeviceServices {
|
||||
if ($inst === null) {
|
||||
$inst = new self;
|
||||
}
|
||||
return $inst;
|
||||
return $inst;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +39,20 @@ class InputDeviceServices {
|
||||
* @return unknown
|
||||
*/
|
||||
function module_loaded() {
|
||||
self::API_Register();
|
||||
static $attempted = null;
|
||||
$processUser = posix_getpwuid(posix_geteuid());
|
||||
if($attempted == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if($processUser['name'] == "root")
|
||||
{
|
||||
self::API_Register();
|
||||
$attempted = true;
|
||||
} else {
|
||||
LogEcho("InputDeviceServices requires Overwatchd to be running as root.", "InputDeviceServices");
|
||||
$attempted = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user