Changeset View
Changeset View
Standalone View
Standalone View
host/main.cpp
Show All 15 Lines | 1 | /* | |||
---|---|---|---|---|---|
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | THE SOFTWARE. | 21 | THE SOFTWARE. | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #include <sys/resource.h> | ||||
25 | #include <unistd.h> | ||||
26 | | ||||
24 | #include <QApplication> | 27 | #include <QApplication> | ||
25 | #include <QDBusConnection> | 28 | #include <QDBusConnection> | ||
26 | #include <QDebug> | 29 | #include <QDebug> | ||
27 | 30 | | |||
28 | #include "connection.h" | 31 | #include "connection.h" | ||
29 | #include "abstractbrowserplugin.h" | 32 | #include "abstractbrowserplugin.h" | ||
30 | 33 | | |||
31 | #include "settings.h" | 34 | #include "settings.h" | ||
Show All 19 Lines | 41 | { | |||
51 | } | 54 | } | ||
52 | data[QStringLiteral("payload")] = QJsonObject({{QStringLiteral("message"), msg}}); | 55 | data[QStringLiteral("payload")] = QJsonObject({{QStringLiteral("message"), msg}}); | ||
53 | 56 | | |||
54 | Connection::self()->sendData(data); | 57 | Connection::self()->sendData(data); | ||
55 | } | 58 | } | ||
56 | 59 | | |||
57 | int main(int argc, char *argv[]) | 60 | int main(int argc, char *argv[]) | ||
58 | { | 61 | { | ||
62 | // Firefox does not use O_CLOEXEC so we inherit tons of open FDs pointing | ||||
63 | // to files and sockets. The latter causes pbi to appear to make requests | ||||
64 | // to the outside, although it doesn't do that: https://bugs.kde.org/show_bug.cgi?id=399449 | ||||
65 | | ||||
66 | struct rlimit maxfd; | ||||
67 | if (getrlimit(RLIMIT_NOFILE, &maxfd) == 0) { | ||||
68 | for (int fd = 3; fd < (int) maxfd.rlim_cur; ++fd) { | ||||
69 | close(fd); | ||||
70 | } | ||||
71 | } | ||||
72 | | ||||
59 | qInstallMessageHandler(msgHandler); | 73 | qInstallMessageHandler(msgHandler); | ||
60 | 74 | | |||
61 | // otherwise when logging out, session manager will ask the host to quit | 75 | // otherwise when logging out, session manager will ask the host to quit | ||
62 | // (it's a "regular X app" after all) and then the browser will complain | 76 | // (it's a "regular X app" after all) and then the browser will complain | ||
63 | qunsetenv("SESSION_MANAGER"); | 77 | qunsetenv("SESSION_MANAGER"); | ||
64 | 78 | | |||
65 | QApplication a(argc, argv); | 79 | QApplication a(argc, argv); | ||
66 | // otherwise will close when download job finishes | 80 | // otherwise will close when download job finishes | ||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |