File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -93,16 +93,20 @@ namespace SDDM {
9393 QString sessionType = processEnvironment ().value (" XDG_SESSION_TYPE" );
9494
9595 // we cannot use setStandardError file as this code is run in the child process
96- // we want to redirect after we setuid so that .xsession-errors is owned by the user
96+ // we want to redirect after we setuid so that the log file is owned by the user
9797
98- // swap the stderr pipe of this subprcess into a file .xsession-errors
99- int fd = ::open (" .xsession-errors" , O_WRONLY | O_CREAT | O_TRUNC, 0600 );
98+ // determine stderr log file based on session type
99+ QString fileName = sessionType == QStringLiteral (" x11" )
100+ ? QStringLiteral (" .xsession-errors" ) : QStringLiteral (" .wayland-errors" );
101+
102+ // swap the stderr pipe of this subprcess into a file
103+ int fd = ::open (qPrintable (fileName), O_WRONLY | O_CREAT | O_TRUNC, 0600 );
100104 if (fd >= 0 )
101105 {
102106 dup2 (fd, STDERR_FILENO);
103107 ::close (fd);
104108 } else {
105- qWarning () << " Could not open stderr to .xsession-errors file " ;
109+ qWarning () << " Could not open stderr to" << fileName ;
106110 }
107111
108112 // redirect any stdout to /dev/null
You can’t perform that action at this time.
0 commit comments