| 1793 | }; |
| 1794 | |
| 1795 | bool AppInitBasicSetup(const ArgsManager &args, std::atomic<int> &exit_status) { |
| 1796 | // Step 1: setup |
| 1797 | #ifdef _MSC_VER |
| 1798 | // Turn off Microsoft heap dump noise |
| 1799 | _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); |
| 1800 | _CrtSetReportFile(_CRT_WARN, CreateFileA("NUL", GENERIC_WRITE, 0, nullptr, |
| 1801 | OPEN_EXISTING, 0, 0)); |
| 1802 | // Disable confusing "helpful" text message on abort, Ctrl-C |
| 1803 | _set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); |
| 1804 | #endif |
| 1805 | #ifdef WIN32 |
| 1806 | // Enable Data Execution Prevention (DEP) |
| 1807 | SetProcessDEPPolicy(PROCESS_DEP_ENABLE); |
| 1808 | #endif |
| 1809 | if (!SetupNetworking()) { |
| 1810 | return InitError(Untranslated("Initializing networking failed")); |
| 1811 | } |
| 1812 | |
| 1813 | #ifndef WIN32 |
| 1814 | if (!args.GetBoolArg("-sysperms", false)) { |
| 1815 | umask(077); |
| 1816 | } |
| 1817 | |
| 1818 | // Clean shutdown on SIGTERM |
| 1819 | registerSignalHandler(SIGTERM, HandleSIGTERM); |
| 1820 | registerSignalHandler(SIGINT, HandleSIGTERM); |
| 1821 | |
| 1822 | // Reopen debug.log on SIGHUP |
| 1823 | registerSignalHandler(SIGHUP, HandleSIGHUP); |
| 1824 | |
| 1825 | // Ignore SIGPIPE, otherwise it will bring the daemon down if the client |
| 1826 | // closes unexpectedly |
| 1827 | signal(SIGPIPE, SIG_IGN); |
| 1828 | #else |
| 1829 | SetConsoleCtrlHandler(consoleCtrlHandler, true); |
| 1830 | #endif |
| 1831 | |
| 1832 | std::set_new_handler(new_handler_terminate); |
| 1833 | |
| 1834 | return true; |
| 1835 | } |
| 1836 | |
| 1837 | bool AppInitParameterInteraction(Config &config, const ArgsManager &args) { |
| 1838 | const CChainParams &chainparams = config.GetChainParams(); |
no test coverage detected