CrashReporter: unbreak build on FreeBSD (#5786)

* CrashReporter: skip Linux field on BSDs after 90a53aed59

In file included from src/debug/CrashReporter.cpp:10:
src/debug/signal-safe.hpp:113:17: error: no member named 'sa_restorer' in 'sigaction'
            act.sa_restorer = NULL;
            ~~~ ^

* CrashReporter: ensure *argv[] is NULL-terminated after 90a53aed59

execv() may fail with EFAULT otherwise.

* hyprpm: add missing header after 335015fe2d

hyprpm/src/core/PluginManager.cpp:165:43: error: use of undeclared identifier 'getuid'
  165 |     const std::string USERNAME = getpwuid(getuid())->pw_name;
      |                                           ^
hyprpm/src/core/PluginManager.cpp:431:45: error: use of undeclared identifier 'getuid'
  431 |     const std::string USERNAME   = getpwuid(getuid())->pw_name;
      |                                             ^
hyprpm/src/core/PluginManager.cpp:558:43: error: use of undeclared identifier 'getuid'
  558 |     const std::string USERNAME = getpwuid(getuid())->pw_name;
      |                                           ^
This commit is contained in:
Jan Beich 2024-04-30 13:14:31 +00:00 committed by GitHub
parent 801437cd54
commit 07e070012b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -15,6 +15,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <pwd.h> #include <pwd.h>
#include <unistd.h>
#include <toml++/toml.hpp> #include <toml++/toml.hpp>

View file

@ -109,8 +109,10 @@ class BufFileWriter {
struct sigaction act; struct sigaction act;
act.sa_handler = SIG_DFL; act.sa_handler = SIG_DFL;
sigemptyset(&act.sa_mask); sigemptyset(&act.sa_mask);
act.sa_flags = SA_NOCLDWAIT; act.sa_flags = SA_NOCLDWAIT;
#ifdef SA_RESTORER
act.sa_restorer = NULL; act.sa_restorer = NULL;
#endif
sigaction(SIGCHLD, &act, NULL); sigaction(SIGCHLD, &act, NULL);
} }
pid_t pid = fork(); pid_t pid = fork();
@ -123,7 +125,7 @@ class BufFileWriter {
if (pid == 0) { if (pid == 0) {
close(pipefd[0]); close(pipefd[0]);
dup2(pipefd[1], STDOUT_FILENO); dup2(pipefd[1], STDOUT_FILENO);
char const* const argv[] = {"/bin/sh", "-c", cmd}; char const* const argv[] = {"/bin/sh", "-c", cmd, NULL};
execv("/bin/sh", (char* const*)argv); execv("/bin/sh", (char* const*)argv);
BufFileWriter<64> failmsg(pipefd[1]); BufFileWriter<64> failmsg(pipefd[1]);