diff --git a/mythtv/programs/mythfrontend/main.cpp b/mythtv/programs/mythfrontend/main.cpp
index fd3c201..2ebda5d 100644
|
a
|
b
|
static bool WasAutomaticStart(void)
|
| 1629 | 1629 | return autoStart; |
| 1630 | 1630 | } |
| 1631 | 1631 | |
| | 1632 | // from https://www.raspberrypi.org/forums/viewtopic.php?f=33&t=16897 |
| | 1633 | // The old way of revoking root with setuid(getuid()) |
| | 1634 | // causes system hang in certain cases on raspberry pi |
| | 1635 | |
| | 1636 | static int revokeRoot (void) |
| | 1637 | { |
| | 1638 | if (getuid () == 0 && geteuid () == 0) // Really running as root |
| | 1639 | return 0; |
| | 1640 | |
| | 1641 | if (geteuid () == 0) // Running setuid root |
| | 1642 | return seteuid (getuid ()) ; // Change effective uid to the uid of the caller |
| | 1643 | return 0; |
| | 1644 | } |
| | 1645 | |
| | 1646 | |
| 1632 | 1647 | int main(int argc, char **argv) |
| 1633 | 1648 | { |
| 1634 | 1649 | bool bPromptForBackend = false; |
| … |
… |
int main(int argc, char **argv)
|
| 1790 | 1805 | qApp->setSetuidAllowed(true); |
| 1791 | 1806 | #endif |
| 1792 | 1807 | |
| 1793 | | #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) |
| 1794 | | // If Qt graphics platform is egl (Raspberry Pi) then setuid hangs |
| 1795 | | LOG(VB_GENERAL, LOG_NOTICE, "QT_QPA_PLATFORM=" + qApp->platformName()); |
| 1796 | | if (qApp->platformName().contains("egl")) |
| 1797 | | ; |
| 1798 | | else |
| 1799 | | #endif |
| 1800 | | if (setuid(getuid()) != 0) |
| | 1808 | if (revokeRoot() != 0) |
| 1801 | 1809 | { |
| 1802 | | LOG(VB_GENERAL, LOG_ERR, "Failed to setuid(), exiting."); |
| | 1810 | LOG(VB_GENERAL, LOG_ERR, "Failed to revokeRoot(), exiting."); |
| 1803 | 1811 | return GENERIC_EXIT_NOT_OK; |
| 1804 | 1812 | } |
| 1805 | 1813 | |