void-packages/srcpkgs/usbguard/patches/musl.patch

85 lines
2.9 KiB
Diff

--- a/src/CLI/usbguard.cpp 2019-06-13 11:51:53.787863657 +0000
+++ b/src/CLI/usbguard.cpp 2019-08-23 01:52:34.233056882 +0000
@@ -26,10 +26,8 @@
#include <map>
#include <iostream>
-#ifndef _GNU_SOURCE
- #define _GNU_SOURCE
-#endif
-#include <cstring> /* GNU version of basename(3) */
+#include <cstring>
+#include <libgen.h>
#include "usbguard.hpp"
#include "usbguard-get-parameter.hpp"
@@ -99,7 +97,7 @@
static int usbguard_cli(int argc, char* argv[])
{
- usbguard_arg0 = ::basename(argv[0]);
+ usbguard_arg0 = ::basename(strdup(argv[0]));
if (argc == 1) {
showTopLevelHelp();
--- a/src/CLI/usbguard-rule-parser.cpp 2019-06-13 11:51:53.783863704 +0000
+++ b/src/CLI/usbguard-rule-parser.cpp 2019-08-23 01:52:34.234056870 +0000
@@ -24,10 +24,8 @@
#include "RuleParser.hpp"
#include <iostream>
-#ifndef _GNU_SOURCE
- #define _GNU_SOURCE
-#endif
#include <cstring>
+#include <libgen.h>
#include <fstream>
#include <getopt.h>
@@ -43,8 +41,10 @@
static void showHelp(std::ostream& stream, const char* usbguard_arg0)
{
- stream << " Usage: " << ::basename(usbguard_arg0) << " [OPTIONS] <rule_spec>" << std::endl;
- stream << " Usage: " << ::basename(usbguard_arg0) << " [OPTIONS] -f <file>" << std::endl;
+ char *usbguard_arg0_copy = strdup(usbguard_arg0);
+ stream << " Usage: " << ::basename(usbguard_arg0_copy) << " [OPTIONS] <rule_spec>" << std::endl;
+ stream << " Usage: " << ::basename(usbguard_arg0_copy) << " [OPTIONS] -f <file>" << std::endl;
+ free(usbguard_arg0_copy);
stream << std::endl;
stream << " Options:" << std::endl;
stream << " -f, --file Interpret the argument as a path to a file that should be parsed." << std::endl;
--- a/src/DBus/gdbus-server.cpp 2019-06-28 08:45:27.616687137 +0000
+++ b/src/DBus/gdbus-server.cpp 2019-08-23 01:52:34.274056367 +0000
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <iostream>
#include <getopt.h>
+#include <libgen.h>
#include "DBusBridge.hpp"
static usbguard::DBusBridge* dbus_bridge = nullptr;
@@ -208,7 +209,9 @@
static void showHelp(std::ostream& stream)
{
- stream << " Usage: " << ::basename(usbguard_arg0) << " [OPTIONS]" << std::endl;
+ char *usbguard_arg0_copy = strdup(usbguard_arg0);
+ stream << " Usage: " << ::basename(usbguard_arg0_copy) << " [OPTIONS]" << std::endl;
+ free(usbguard_arg0_copy);
stream << std::endl;
stream << " Options:" << std::endl;
stream << " -s, --system Listen on the system bus." << std::endl;
--- a/src/Library/public/usbguard/Exception.hpp 2019-06-28 08:45:27.620687089 +0000
+++ b/src/Library/public/usbguard/Exception.hpp 2019-08-23 01:52:34.323055751 +0000
@@ -116,7 +116,8 @@
static std::string reasonFromErrno(const int errno_value)
{
char buffer[1024];
- return std::string(strerror_r(errno_value, buffer, sizeof buffer));
+ strerror_r(errno_value, buffer, sizeof buffer);
+ return std::string(buffer);
}
};