From 8697bcd7e9e6826cc28a8f94e4e137b03909a3d6 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 8 Sep 2020 11:27:42 +0300 Subject: [PATCH] xwayland: Avoid printing "FATAL ERROR" log messages Since we want kwin to survive Xwayland crashes, printing "FATAL ERROR" is highly undesirable. --- xwl/xwayland.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/xwl/xwayland.cpp b/xwl/xwayland.cpp index 74f4a1cbb2..1b3cf4262f 100644 --- a/xwl/xwayland.cpp +++ b/xwl/xwayland.cpp @@ -37,13 +37,15 @@ #endif #include +#include +#include #include static void readDisplay(int pipe) { QFile readPipe; if (!readPipe.open(pipe, QIODevice::ReadOnly)) { - std::cerr << "FATAL ERROR failed to open pipe to start X Server" << std::endl; + qCWarning(KWIN_XWL) << "Failed to open X11 display name pipe:" << readPipe.errorString(); exit(1); } QByteArray displayNumber = readPipe.readLine(); @@ -90,32 +92,32 @@ void Xwayland::start() int pipeFds[2]; if (pipe(pipeFds) != 0) { - std::cerr << "FATAL ERROR failed to create pipe to start Xwayland " << std::endl; + qCWarning(KWIN_XWL, "Failed to create pipe to start Xwayland: %s", strerror(errno)); emit errorOccurred(); return; } int sx[2]; if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sx) < 0) { - std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl; + qCWarning(KWIN_XWL, "Failed to open socket for XCB connection: %s", strerror(errno)); emit errorOccurred(); return; } int fd = dup(sx[1]); if (fd < 0) { - std::cerr << "FATAL ERROR: failed to open socket to open XCB connection" << std::endl; + qCWarning(KWIN_XWL, "Failed to open socket for XCB connection: %s", strerror(errno)); emit errorOccurred(); return; } const int waylandSocket = waylandServer()->createXWaylandConnection(); if (waylandSocket == -1) { - std::cerr << "FATAL ERROR: failed to open socket for Xwayland" << std::endl; + qCWarning(KWIN_XWL, "Failed to open socket for Xwayland server: %s", strerror(errno)); emit errorOccurred(); return; } const int wlfd = dup(waylandSocket); if (wlfd < 0) { - std::cerr << "FATAL ERROR: failed to open socket for Xwayland" << std::endl; + qCWarning(KWIN_XWL, "Failed to open socket for Xwayland server: %s", strerror(errno)); emit errorOccurred(); return; }