forked from hyprwm/Hyprland
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(CrashReporter): make it mostly async-signal-safe
`CrashReporter::createAndSaveCrash()` is not async-signal-safe, resulting in random deadlocks/double-crashes during Hyprland crashes. This changes the function to be (mostly) async-signal-safe.
- Loading branch information
Showing
6 changed files
with
339 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include "signal-safe.hpp" | ||
|
||
#ifndef __GLIBC__ | ||
#include <signal.h> | ||
#endif | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
#include <string.h> | ||
|
||
extern char** environ; | ||
|
||
char const* sig_getenv(char const* name) { | ||
int len = strlen(name); | ||
for (char** var = environ; *var != NULL; var++) { | ||
if (strncmp(*var, name, len) == 0 && (*var)[len] == '=') { | ||
return (*var) + len + 1; | ||
} | ||
} | ||
return NULL; | ||
} | ||
|
||
char const* sig_strsignal(int sig) { | ||
#ifdef __GLIBC__ | ||
return sigabbrev_np(sig); | ||
#elif defined(__DragonFly__) || defined(__FreeBSD__) | ||
return sys_signame[sig]; | ||
#else | ||
return "unknown"; | ||
#endif | ||
} |
Oops, something went wrong.