mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10:00
launch: use dup2 to reset daemon stdio over close+open
This commit is contained in:
parent
7208f68bb7
commit
7f7ab6bc8a
2 changed files with 19 additions and 10 deletions
|
|
@ -73,6 +73,7 @@ set shell id.
|
||||||
- Fixed JsonAdapter sending unnecessary property changes for primitive values.
|
- Fixed JsonAdapter sending unnecessary property changes for primitive values.
|
||||||
- Fixed JsonAdapter serialization for lists.
|
- Fixed JsonAdapter serialization for lists.
|
||||||
- Fixed pipewire crashes after hotplugging devices and changing default outputs.
|
- Fixed pipewire crashes after hotplugging devices and changing default outputs.
|
||||||
|
- Fixed launches failing for `--daemonize` on some systems.
|
||||||
|
|
||||||
## Packaging Changes
|
## Packaging Changes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,21 +84,29 @@ void exitDaemon(int code) {
|
||||||
|
|
||||||
close(DAEMON_PIPE);
|
close(DAEMON_PIPE);
|
||||||
|
|
||||||
close(STDIN_FILENO);
|
auto fd = open("/dev/null", O_RDWR);
|
||||||
close(STDOUT_FILENO);
|
if (fd == -1) {
|
||||||
close(STDERR_FILENO);
|
qCritical().nospace() << "Failed to open /dev/null for daemon stdio" << errno << ": "
|
||||||
|
<< qt_error_string();
|
||||||
if (open("/dev/null", O_RDONLY) != STDIN_FILENO) { // NOLINT
|
return;
|
||||||
qFatal() << "Failed to open /dev/null on stdin";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open("/dev/null", O_WRONLY) != STDOUT_FILENO) { // NOLINT
|
if (dup2(fd, STDIN_FILENO) != STDIN_FILENO) { // NOLINT
|
||||||
qFatal() << "Failed to open /dev/null on stdout";
|
qCritical().nospace() << "Failed to set daemon stdin to /dev/null" << errno << ": "
|
||||||
|
<< qt_error_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (open("/dev/null", O_WRONLY) != STDERR_FILENO) { // NOLINT
|
if (dup2(fd, STDOUT_FILENO) != STDOUT_FILENO) { // NOLINT
|
||||||
qFatal() << "Failed to open /dev/null on stderr";
|
qCritical().nospace() << "Failed to set daemon stdout to /dev/null" << errno << ": "
|
||||||
|
<< qt_error_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dup2(fd, STDERR_FILENO) != STDERR_FILENO) { // NOLINT
|
||||||
|
qCritical().nospace() << "Failed to set daemon stderr to /dev/null" << errno << ": "
|
||||||
|
<< qt_error_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue