mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-17 05:05:14 +03:00
230 lines
6.1 KiB
Diff
230 lines
6.1 KiB
Diff
fix differences between musl and glibc
|
|
* change error funtion to err
|
|
* change sys/poll.h to poll.h
|
|
* add ftw-missing.h with defines missing in alpine ftw.h
|
|
* remove test subdir from makefile.am as tests fail
|
|
|
|
--- a/Makefile.am
|
|
+++ b/Makefile.am
|
|
@@ -14,7 +14,7 @@
|
|
|
|
else
|
|
|
|
-SUBDIRS = . test loleaflet
|
|
+SUBDIRS = . loleaflet
|
|
|
|
export ENABLE_DEBUG
|
|
|
|
--- a/common/FileUtil.cpp
|
|
+++ b/common/FileUtil.cpp
|
|
@@ -12,6 +12,7 @@
|
|
#include "FileUtil.hpp"
|
|
|
|
#include <ftw.h>
|
|
+#include "ftw-missing.h"
|
|
#include <sys/stat.h>
|
|
#ifdef __linux
|
|
#include <sys/vfs.h>
|
|
--- a/common/IoUtil.cpp
|
|
+++ b/common/IoUtil.cpp
|
|
@@ -11,7 +11,7 @@
|
|
|
|
#include "IoUtil.hpp"
|
|
|
|
-#include <sys/poll.h>
|
|
+#include <poll.h>
|
|
|
|
#include <cassert>
|
|
#include <cstdlib>
|
|
--- a/common/Seccomp.cpp
|
|
+++ b/common/Seccomp.cpp
|
|
@@ -17,6 +17,7 @@
|
|
|
|
#include <dlfcn.h>
|
|
#include <ftw.h>
|
|
+#include "ftw-missing.h"
|
|
#include <linux/audit.h>
|
|
#include <linux/filter.h>
|
|
#if DISABLE_SECCOMP == 0
|
|
--- a/common/Session.cpp
|
|
+++ b/common/Session.cpp
|
|
@@ -14,6 +14,7 @@
|
|
#include <sys/stat.h>
|
|
#include <sys/types.h>
|
|
#include <ftw.h>
|
|
+#include "ftw-missing.h"
|
|
#include <utime.h>
|
|
|
|
#include <cassert>
|
|
--- a/common/SigUtil.cpp
|
|
+++ b/common/SigUtil.cpp
|
|
@@ -11,11 +11,11 @@
|
|
|
|
#include "SigUtil.hpp"
|
|
|
|
-#if !defined(__ANDROID__)
|
|
+#if !defined(__ANDROID__) && defined(__GLIBC__)
|
|
# include <execinfo.h>
|
|
#endif
|
|
#include <csignal>
|
|
-#include <sys/poll.h>
|
|
+#include <poll.h>
|
|
#include <sys/stat.h>
|
|
#include <sys/uio.h>
|
|
#include <unistd.h>
|
|
@@ -265,7 +265,7 @@
|
|
|
|
void dumpBacktrace()
|
|
{
|
|
-#if !defined(__ANDROID__)
|
|
+#if !defined(__ANDROID__) && defined(__GLIBC__)
|
|
Log::signalLog("\nBacktrace ");
|
|
Log::signalLogNumber(getpid());
|
|
Log::signalLog(":\n");
|
|
@@ -278,7 +278,7 @@
|
|
backtrace_symbols_fd(backtraceBuffer, numSlots, STDERR_FILENO);
|
|
}
|
|
#else
|
|
- LOG_SYS("Backtrace not available on Android.");
|
|
+ LOG_SYS("Backtrace not available on Android or Musl.");
|
|
#endif
|
|
|
|
if (std::getenv("LOOL_DEBUG"))
|
|
--- a/common/Util.cpp
|
|
+++ b/common/Util.cpp
|
|
@@ -12,7 +12,7 @@
|
|
#include "Util.hpp"
|
|
|
|
#include <csignal>
|
|
-#include <sys/poll.h>
|
|
+#include <poll.h>
|
|
#ifdef __linux
|
|
#include <sys/prctl.h>
|
|
#include <sys/syscall.h>
|
|
--- /dev/null
|
|
+++ b/common/ftw-missing.h
|
|
@@ -0,0 +1,6 @@
|
|
+#define FTW_ACTIONRETVAL 16
|
|
+
|
|
+#define FTW_CONTINUE 0
|
|
+#define FTW_STOP 1
|
|
+#define FTW_SKIP_SUBTREE 2
|
|
+#define FTW_SKIP_SIBLINGS 3
|
|
--- a/kit/Kit.cpp
|
|
+++ b/kit/Kit.cpp
|
|
@@ -16,6 +16,7 @@
|
|
#include <dlfcn.h>
|
|
#ifdef __linux
|
|
#include <ftw.h>
|
|
+#include "ftw-missing.h"
|
|
#include <sys/capability.h>
|
|
#include <sys/sysmacros.h>
|
|
#endif
|
|
--- a/tools/map.cpp
|
|
+++ b/tools/map.cpp
|
|
@@ -20,7 +20,7 @@
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
#include <errno.h>
|
|
-#include <error.h>
|
|
+#include <err.h>
|
|
#include <fcntl.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
@@ -99,7 +99,7 @@
|
|
snprintf(path_proc, sizeof(path_proc), "/proc/%d/%s", proc_id, name);
|
|
int fd = open(path_proc, 0);
|
|
if (fd < 0)
|
|
- error(EXIT_FAILURE, errno, "Failed to open %s", path_proc);
|
|
+ err(EXIT_FAILURE, "Failed to open %s", path_proc);
|
|
return fd;
|
|
}
|
|
|
|
@@ -259,7 +259,7 @@
|
|
data.resize (map.size());
|
|
if (lseek(mem_fd, map.getStart(), SEEK_SET) < 0 ||
|
|
read(mem_fd, &data[0], map.size()) != (int)map.size())
|
|
- error(EXIT_FAILURE, errno, "Failed to seek in /proc/%d/mem to %lld",
|
|
+ err(EXIT_FAILURE, "Failed to seek in /proc/%d/mem to %lld",
|
|
_proc_id, map.getStart());
|
|
|
|
scanForSalStrings(map, data);
|
|
@@ -341,9 +341,9 @@
|
|
parentData.resize(0x1000);
|
|
|
|
if (lseek(mem_fd, page, SEEK_SET) < 0)
|
|
- error(EXIT_FAILURE, errno, "Failed to seek in /proc/<pid>/mem to %lld", page);
|
|
+ err(EXIT_FAILURE, "Failed to seek in /proc/<pid>/mem to %lld", page);
|
|
if (read(mem_fd, &pageData[0], 0x1000) != 0x1000)
|
|
- error(EXIT_FAILURE, errno, "Failed to read page %lld from /proc/<pid>/mem", page);
|
|
+ err(EXIT_FAILURE, "Failed to read page %lld from /proc/<pid>/mem", page);
|
|
|
|
if (lseek(parent_fd, page, SEEK_SET) < 0)
|
|
parentData.resize(0);
|
|
@@ -450,10 +450,10 @@
|
|
for (addr_t p : vaddrs)
|
|
{
|
|
if (lseek(fd, (p / 0x1000 * 8), SEEK_SET) < 0)
|
|
- error(EXIT_FAILURE, errno, "Failed to seek in pagemap");
|
|
+ err(EXIT_FAILURE, "Failed to seek in pagemap");
|
|
addr_t vaddrData;
|
|
if (read(fd, &vaddrData, 8) < 0)
|
|
- error(EXIT_FAILURE, errno, "Failed to read vaddrdata");
|
|
+ err(EXIT_FAILURE, "Failed to read vaddrdata");
|
|
{
|
|
// https://patchwork.kernel.org/patch/6787921/
|
|
// fprintf(stderr, "addr: 0x%8llx bits: 0x%8llx : %s\n", p, vaddrData,
|
|
@@ -521,7 +521,7 @@
|
|
std::vector<addr_t> *pushTo = nullptr;
|
|
|
|
if ((file_pointer = fopen(file, "r")) == nullptr)
|
|
- error(EXIT_FAILURE, errno, "%s", file);
|
|
+ err(EXIT_FAILURE, "%s", file);
|
|
|
|
while (fgets(buffer, sizeof(buffer), file_pointer))
|
|
{
|
|
@@ -612,7 +612,7 @@
|
|
char buffer[4096];
|
|
int len;
|
|
if ((len = read(fd, buffer, sizeof (buffer))) < 0)
|
|
- error(EXIT_FAILURE, errno, "Failed to read /proc/%d/stat", proc_id);
|
|
+ err(EXIT_FAILURE, "Failed to read /proc/%d/stat", proc_id);
|
|
close (fd);
|
|
buffer[len] = '\0';
|
|
|
|
@@ -679,12 +679,12 @@
|
|
|
|
root_proc = opendir("/proc");
|
|
if (!root_proc)
|
|
- error(EXIT_FAILURE, errno, "%s", "/proc");
|
|
+ err(EXIT_FAILURE, "%s", "/proc");
|
|
|
|
while ((dir_proc = readdir(root_proc)))
|
|
{
|
|
if (!dir_proc && !dir_proc->d_name[0])
|
|
- error(EXIT_FAILURE, ENOTDIR, "bad dir");
|
|
+ err(EXIT_FAILURE, "bad dir");
|
|
|
|
if (*dir_proc->d_name > '0' && *dir_proc->d_name <= '9')
|
|
{
|
|
--- a/wsd/Admin.cpp
|
|
+++ b/wsd/Admin.cpp
|
|
@@ -11,7 +11,7 @@
|
|
|
|
#include <cassert>
|
|
#include <mutex>
|
|
-#include <sys/poll.h>
|
|
+#include <poll.h>
|
|
#include <unistd.h>
|
|
|
|
#include <Poco/Net/HTTPCookie.h>
|
|
--- a/wsd/AdminModel.hpp
|
|
+++ b/wsd/AdminModel.hpp
|
|
@@ -13,6 +13,7 @@
|
|
#include <memory>
|
|
#include <set>
|
|
#include <string>
|
|
+#include <list>
|
|
|
|
#include <Poco/Process.h>
|
|
|